Upgrade webpack to 4.18.0

Add 'watch' and 'dev' npm scripts
This commit is contained in:
Donald 2018-09-11 14:13:38 +08:00
parent ee48c72922
commit d60ea5e7cb
3 changed files with 26 additions and 8 deletions

View file

@ -4,7 +4,9 @@
"description": "ScratchJr",
"scripts": {
"lint": "eslint src/**",
"build": "webpack"
"watch": "webpack --watch --progress --mode=development --hide-modules",
"dev": "webpack --mode=development --hide-modules",
"build": "webpack --mode=production --hide-modules"
},
"author": "Massachusetts Institute of Technology",
"license": "BSD-3-Clause",
@ -15,7 +17,7 @@
"devDependencies": {
"babel-core": "^6.4.0",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.1",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.3.13",
"esformatter": "^0.8.1",
"esformatter-braces": "^1.2.1",
@ -25,7 +27,9 @@
"eslint": "^1.10.3",
"expose-loader": "^0.7.1",
"strip-sourcemap-loader": "0.0.1",
"webpack": "^1.12.11"
"webpack": "^4.18.0",
"webpack-cli": "^3.1.0",
"webpack-notifier": "^1.6.0"
},
"dependencies": {
"intl": "^1.0.1",

View file

@ -19,7 +19,7 @@ require('intl/locale-data/jsonp/sv.js');
require('intl/locale-data/jsonp/th.js');
require('intl/locale-data/jsonp/zh.js');
require('expose?IntlMessageFormat!intl-messageformat');
require('expose-loader?IntlMessageFormat!intl-messageformat');
require('intl-messageformat/dist/locale-data/ca');
require('intl-messageformat/dist/locale-data/de');
require('intl-messageformat/dist/locale-data/en');
@ -94,7 +94,7 @@ export default class Localization {
// ensure it's lower case to match filename
topLevel = currentLocale.toLowerCase();
}
// Get messages
IO.requestFromServer(localizationRoot + 'localizations/' + topLevel + '.json', (result) => {
localizationMessages = JSON.parse(result);

View file

@ -1,14 +1,22 @@
var WebpackNotifierPlugin = require('webpack-notifier');
module.exports = {
devtool: 'source-map',
entry: {
app: './src/entry/app.js'
},
output: {
path: './src/build/bundles',
path: __dirname + '/src/build/bundles',
filename: '[name].bundle.js'
},
performance: {
hints: false
},
watchOptions: {
ignored: ["node_modules", "src/build/**/*"]
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
include: /node_modules/,
@ -23,5 +31,11 @@ module.exports = {
}
}
]
}
},
plugins: [
new WebpackNotifierPlugin({
title: "ScratchJr",
alwaysNotify: true
})
]
};