build(webpack): Fix the request of a dependency is an expression (#337)
* build(webpack): Fix the request of a dependency is an expression Critical dependency: the request of a dependency is an expression * style: Fix spaces after object literal braces
This commit is contained in:
committed by
László Monda
parent
1796e61f02
commit
67a55363da
@@ -1,10 +1,13 @@
|
|||||||
var webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
var SvgStore = require('webpack-svgstore-plugin');
|
const SvgStore = require('webpack-svgstore-plugin');
|
||||||
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
var path = require('path');
|
const path = require('path');
|
||||||
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
|
const CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
|
||||||
|
const ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
|
||||||
|
|
||||||
var rootDir = path.resolve(__dirname, '../');
|
const webpackHelper = require('../../scripts/webpack-helper');
|
||||||
|
|
||||||
|
const rootDir = path.resolve(__dirname, '../');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
@@ -19,7 +22,7 @@ module.exports = {
|
|||||||
target: 'electron-renderer',
|
target: 'electron-renderer',
|
||||||
externals: {
|
externals: {
|
||||||
usb: 'usb',
|
usb: 'usb',
|
||||||
'node-hid':'nodeHid'
|
'node-hid': 'nodeHid'
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -95,7 +98,12 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new CommonsChunkPlugin({
|
new CommonsChunkPlugin({
|
||||||
name: ['app', 'vendor', 'polyfills']
|
name: ['app', 'vendor', 'polyfills']
|
||||||
})
|
}),
|
||||||
|
new ContextReplacementPlugin(
|
||||||
|
// The (\\|\/) piece accounts for path separators in *nix and Windows
|
||||||
|
/angular(\\|\/)core(\\|\/)@angular/,
|
||||||
|
webpackHelper.root(__dirname, './src') // location of your src
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|||||||
5
scripts/webpack-helper.js
Normal file
5
scripts/webpack-helper.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports.root = function root(dir, __path) {
|
||||||
|
return path.join(dir, __path);
|
||||||
|
};
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
var webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
var SvgStore = require('webpack-svgstore-plugin');
|
const SvgStore = require('webpack-svgstore-plugin');
|
||||||
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
var path = require('path');
|
const path = require('path');
|
||||||
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
|
const CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
|
||||||
|
const ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
|
||||||
|
|
||||||
var rootDir = path.resolve(__dirname, '../');
|
const webpackHelper = require('../../scripts/webpack-helper');
|
||||||
|
|
||||||
|
const rootDir = path.resolve(__dirname, '../');
|
||||||
console.log(rootDir, __dirname);
|
console.log(rootDir, __dirname);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -78,7 +81,12 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new CommonsChunkPlugin({
|
new CommonsChunkPlugin({
|
||||||
name: ['app', 'vendor', 'polyfills']
|
name: ['app', 'vendor', 'polyfills']
|
||||||
})
|
}),
|
||||||
|
new ContextReplacementPlugin(
|
||||||
|
// The (\\|\/) piece accounts for path separators in *nix and Windows
|
||||||
|
/angular(\\|\/)core(\\|\/)@angular/,
|
||||||
|
webpackHelper.root(__dirname, './src') // location of your src
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user