Skip to content

Commit

Permalink
fix: add common entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
ozyx committed Jan 12, 2024
1 parent 123da3f commit 2bbfa5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { fileURLToPath } from 'node:url';
const projectRootDir = fileURLToPath(new URL('../', import.meta.url));

/** @type {import('webpack').Configuration} */
const WEBPACK_COMMON_CONFIG = {
const commonConfig = {
performance: {
hints: false
},
Expand All @@ -35,6 +35,9 @@ const WEBPACK_COMMON_CONFIG = {
saveAs: "file-saver/src/FileSaver.js",
}
},
entry: {
'openmct-yamcs': './src/plugin.js'
},
module: {
rules: [
{
Expand All @@ -53,5 +56,5 @@ const WEBPACK_COMMON_CONFIG = {
library: 'openmctYamcs'
}
};
export default WEBPACK_COMMON_CONFIG;
export default commonConfig;

11 changes: 7 additions & 4 deletions .webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@

import path from 'path';
import { merge } from 'webpack-merge';
import common from './webpack.common.js';
import commonConfig from './webpack.common.js';
import { fileURLToPath } from 'node:url';

const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
export default merge(common, {

/** @type {import('webpack').Configuration} */
const devConfig = {
context: projectRootDir,
mode: 'development',
devtool: 'eval-source-map',
entry: {
'openmct-yamcs-example': path.resolve(projectRootDir, 'example/index.js')
'openmct-yamcs-example': './example/index.js'
},
devServer: {
compress: true,
Expand All @@ -58,4 +60,5 @@ export default merge(common, {
}
}
}
});
}
export default merge(commonConfig, devConfig);
10 changes: 4 additions & 6 deletions .webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/

import path from 'path';
import { merge } from 'webpack-merge';
import common from './webpack.common.js';
import { fileURLToPath } from 'node:url';

const projectRootDir = fileURLToPath(new URL('../', import.meta.url));

export default merge(common, {
/** @type {import('webpack').Configuration} */
const prodConfig = {
context: projectRootDir,
mode: 'production',
entry: {
'openmct-yamcs': path.resolve(projectRootDir, 'src/plugin.js')
},
devtool: 'source-map'
});
}
export default merge(common, prodConfig);

0 comments on commit 2bbfa5f

Please sign in to comment.