forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.plugin.js
More file actions
25 lines (24 loc) · 767 Bytes
/
build.plugin.js
File metadata and controls
25 lines (24 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const fse = require('fs-extra');
// read from lerna
const lernaConfig = JSON.parse(fse.readFileSync('../../lerna.json', 'utf8'));
const { version } = lernaConfig;
module.exports = ({ context, onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.resolve.plugin('tsconfigpaths').use(TsconfigPathsPlugin, [
{
configFile: './tsconfig.json',
},
]);
config
.plugin('define')
.use(context.webpack.DefinePlugin, [{
VERSION_PLACEHOLDER: JSON.stringify(version),
}]);
config.plugins.delete('hot');
config.devServer.hot(false);
if (context.command === 'start') {
config.devtool('inline-source-map');
}
});
};