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", "description": "ScratchJr",
"scripts": { "scripts": {
"lint": "eslint src/**", "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", "author": "Massachusetts Institute of Technology",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
@ -15,7 +17,7 @@
"devDependencies": { "devDependencies": {
"babel-core": "^6.4.0", "babel-core": "^6.4.0",
"babel-eslint": "^4.1.6", "babel-eslint": "^4.1.6",
"babel-loader": "^6.2.1", "babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.3.13", "babel-preset-es2015": "^6.3.13",
"esformatter": "^0.8.1", "esformatter": "^0.8.1",
"esformatter-braces": "^1.2.1", "esformatter-braces": "^1.2.1",
@ -25,7 +27,9 @@
"eslint": "^1.10.3", "eslint": "^1.10.3",
"expose-loader": "^0.7.1", "expose-loader": "^0.7.1",
"strip-sourcemap-loader": "0.0.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": { "dependencies": {
"intl": "^1.0.1", "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/th.js');
require('intl/locale-data/jsonp/zh.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/ca');
require('intl-messageformat/dist/locale-data/de'); require('intl-messageformat/dist/locale-data/de');
require('intl-messageformat/dist/locale-data/en'); require('intl-messageformat/dist/locale-data/en');

View file

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