Skip to content

Commit ff8b21f

Browse files
chore(deps): update dependency webpack to v4 (#247)
1 parent e65270b commit ff8b21f

File tree

5 files changed

+919
-560
lines changed

5 files changed

+919
-560
lines changed

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"file-loader": "^6.0.0",
3232
"gh-release": "^3.4.0",
3333
"gotrue-js": "^0.9.21",
34-
"html-webpack-plugin": "^2.28.0",
34+
"html-webpack-plugin": "^4.3.0",
3535
"json-loader": "^0.5.4",
3636
"mkdirp": "^0.5.1",
3737
"mobx": "^3.2.2",
@@ -47,7 +47,8 @@
4747
"rimraf": "^2.6.2",
4848
"source-map-loader": "^0.2.1",
4949
"url-loader": "^0.6.2",
50-
"webpack": "^3.0.0",
50+
"webpack": "^4.0.0",
51+
"webpack-cli": "^3.3.11",
5152
"webpack-dev-server": "^3.0.0",
5253
"webpack-node-externals": "^1.6.0"
5354
},
@@ -67,8 +68,8 @@
6768
"build:umd": "cross-env NODE_ENV=production webpack --config webpack.umd.config.babel.js",
6869
"changelog": "auto-changelog --template keepachangelog -p && git add CHANGELOG.md",
6970
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --progress --config webpack.config.babel.js",
70-
"format": "prettier --write 'src/**/*.js'",
71-
"format-preview": "prettier --list-different 'src/**/*.js'",
71+
"format": "prettier --write 'src/**/*.js' '*.js'",
72+
"format-preview": "prettier --list-different 'src/**/*.js' '*.js'",
7273
"prebuild": "rimraf build && mkdirp build",
7374
"prepublish": "run-s build",
7475
"prestart": "run-s build",

src/foo.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<% for (var chunk in htmlWebpackPlugin.files.css) { %>
55
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[chunk] %>">
66
<% } %>
7-
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
8-
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
7+
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
8+
<script src="<%= htmlWebpackPlugin.files.js[chunk] %>"></script>
99
<% } %>
1010
<meta charset="utf-8">
1111
<title>Netlify Identity Widget</title>

src/index.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<% for (var chunk in htmlWebpackPlugin.files.css) { %>
55
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[chunk] %>">
66
<% } %>
7-
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
8-
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
7+
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
8+
<script src="<%= htmlWebpackPlugin.files.js[chunk] %>"></script>
99
<% } %>
1010
<meta charset="utf-8">
1111
<title>Netlify Identity Widget</title>

webpack.config.babel.js

+7-40
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import postCSSImport from "postcss-import";
44
import postCSSNested from "postcss-nested";
55
import postCSSNext from "postcss-cssnext";
66
import path from "path";
7-
const ENV = process.env.NODE_ENV || "development";
87

9-
const CSS_MAPS = ENV !== "production";
8+
const ENV = process.env.NODE_ENV || "development";
9+
const isProduction = ENV === "production";
10+
const CSS_MAPS = !isProduction;
1011

1112
module.exports = {
1213
context: path.resolve(__dirname, "src"),
14+
mode: isProduction ? "production" : "development",
1315
entry: {
1416
"netlify-identity-widget": "./index.js"
1517
},
@@ -65,7 +67,7 @@ module.exports = {
6567
},
6668
{
6769
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
68-
use: ENV === "production" ? "file-loader" : "url-loader"
70+
use: isProduction ? "file-loader" : "url-loader"
6971
}
7072
]
7173
},
@@ -87,42 +89,7 @@ module.exports = {
8789
inject: false,
8890
minify: { collapseWhitespace: true }
8991
})
90-
].concat(
91-
ENV === "production"
92-
? [
93-
new webpack.optimize.UglifyJsPlugin({
94-
sourceMap: true,
95-
output: {
96-
comments: false
97-
},
98-
compress: {
99-
unsafe_comps: true,
100-
properties: true,
101-
keep_fargs: false,
102-
pure_getters: true,
103-
collapse_vars: true,
104-
unsafe: true,
105-
warnings: false,
106-
screw_ie8: true,
107-
sequences: true,
108-
dead_code: true,
109-
drop_debugger: true,
110-
comparisons: true,
111-
conditionals: true,
112-
evaluate: true,
113-
booleans: true,
114-
loops: true,
115-
unused: true,
116-
hoist_funs: true,
117-
if_return: true,
118-
join_vars: true,
119-
cascade: true,
120-
drop_console: false
121-
}
122-
})
123-
]
124-
: []
125-
),
92+
],
12693

12794
stats: { colors: true },
12895

@@ -135,7 +102,7 @@ module.exports = {
135102
setImmediate: false
136103
},
137104

138-
devtool: ENV === "production" ? "source-map" : "cheap-module-eval-source-map",
105+
devtool: isProduction ? "source-map" : "cheap-module-eval-source-map",
139106

140107
devServer: {
141108
port: process.env.PORT || 8080,

0 commit comments

Comments
 (0)