Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
webpack 3 config
D:\MyExperiments\nnn-mmm-ui_npm_update>npm run node
> ReportTool@0.0.1 node D:\MyExperiments\nnn-mmm-ui_npm_update
> node --harmony --max_old_space_size=8192 --optimize_for_size --max_executable_size=4096 --stack_size=4096 app.js
2017-09-20T12:10:56.563Z - info: [D:\MyExperiments\nnn-mmm-ui_npm_update\jjjjSchedulerWorker.js] jjjj scheduler started
2017-09-20T12:10:57.792Z - info: [D:\MyExperiments\nnn-mmm-ui_npm_update\serviceWorker.js] Express https server listening on port 5252
2017-09-20T12:10:57.801Z - info: [D:\MyExperiments\nnn-mmm-ui_npm_update\serviceWorker.js] Client server listening on port 5253
D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\RequestShortener.js:15
return request.replace(NORMALIZE_SLASH_DIRECTION_REGEXP, "/");
^
TypeError: request.replace is not a function
at normalizeBackSlashDirection (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\RequestShortener.js:15:17)
at new RequestShortener (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\RequestShortener.js:25:15)
at Stats.toJson (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Stats.js:100:28)
at Compiler.<anonymous> (D:\MyExperiments\nnn-mmm-ui_npm_update\dasboard-webapp\node_modules\html-webpack-plugin\index.js:68:44)
at Compiler.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:206:13)
at Compiler.emitAssets (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compiler.js:358:8)
at onCompiled (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compiler.js:57:19)
at next (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:202:11)
at Compiler.<anonymous> (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\CachePlugin.js:78:5)
at Compiler.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:206:13)
at compilation.seal.err (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compiler.js:511:11)
at Compilation.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:195:46)
at Compilation.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:195:46)
at self.applyPluginsAsync.err (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compilation.js:662:11)
at Compilation.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:195:46)
at self.applyPluginsAsync.err (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compilation.js:657:10)
at Compilation.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:195:46)
at sealPart2 (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compilation.js:653:9)
at Compilation.applyPluginsAsyncSeries (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:195:46)
at Compilation.seal (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compilation.js:596:8)
at applyPluginsParallel.err (D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\webpack\lib\Compiler.js:508:17)
at D:\MyExperiments\nnn-mmm-ui_npm_update\node_modules\tapable\lib\Tapable.js:289:11
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-09-20T12:11:15.987Z - error: [D:\MyExperiments\nnn-mmm-ui_npm_update\master.js] service worker has been disconnected!
Terminate batch job (Y/N)? y
// this is executed by this code:
// clientApp.use(webpackMiddleware(webpack(webpackConfig)));
var webpack = require('webpack');
var path = require('path');
//Import Webpack Plugins
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
//Choose build options
var ENV = process.env.NODE_ENV || 'development';
var isProd = ENV === 'production';
var prodPlugins = [];
if (isProd) {
prodPlugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: true
}
}));
}
var devtool = false;
// if (!isProd) {
// devtool = 'source-map';
// }
module.exports = {
devtool: devtool,
entry: {
vendor: ['jquery-ui'],
bundle: path.join(__dirname, './src/jsc/app.js')
},
output: {
path: path.resolve(__dirname, '/../web_build'),
publicPath: '/',
filename: 'jsc/[name]-[hash].js'
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.ContextReplacementPlugin(
/moment[\/\\]locale$/,
/^(en-gb|ru)\.js$/
),
new HtmlWebpackPlugin({
chunks: ['vendor', 'bundle'],
filename: 'index.html',
inject: 'head',
favicon: path.join(__dirname, 'src/ico/faviconNew.png'),
template: path.join(__dirname, 'src/index.html')
}),
new ExtractTextPlugin({
filename: "[name]-[contenthash].css",
allChunks: true
}),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: Infinity
}),
new webpack.ProvidePlugin({
_: 'underscore',
moment: 'moment',
Highcharts: 'highcharts'
}),
new webpack.LoaderOptionsPlugin({
debug: true
})
].concat(prodPlugins),
// root containth destinations, where webpack will be searching for required files
// ../config folder is needed to require client.json file
resolve: {
modules: [path.resolve(__dirname, '../config'), "node_modules"]
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
// include: /(jsc|styles)/,
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader"
]
},
{
test: /\.less/,
use: [
"style-loader",
"css-loader",
"less-loader"
]
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)/,
loader: 'file-loader?name=[path][name].[ext]'
},
{
test: /\.styl/,
use: [
"style-loader",
"css-loader",
"stylus-loader",
"resolve-url-loader"
]
},
{
test: /\.(html)$/,
loader: 'html-loader'
},
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
}, {
loader: 'expose-loader',
options: '$'
}]
},
{
test: require.resolve('angular'),
use: [{
loader: 'expose-loader',
options: 'angular'
}]
},
{
test: require.resolve('highcharts'),
use: [{
loader: 'expose-loader',
options: 'Highcharts'
}]
},
{
test: require.resolve('moment'),
use: [{
loader: 'expose-loader',
options: 'moment'
}]
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.