Skip to content

chore(deps): update dependency webpack to v4 #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"file-loader": "^6.0.0",
"gh-release": "^3.4.0",
"gotrue-js": "^0.9.21",
"html-webpack-plugin": "^2.28.0",
"html-webpack-plugin": "^4.3.0",
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
"mobx": "^3.2.2",
Expand All @@ -47,7 +47,8 @@
"rimraf": "^2.6.2",
"source-map-loader": "^0.2.1",
"url-loader": "^0.6.2",
"webpack": "^3.0.0",
"webpack": "^4.0.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.0.0",
"webpack-node-externals": "^1.6.0"
},
Expand All @@ -67,8 +68,8 @@
"build:umd": "cross-env NODE_ENV=production webpack --config webpack.umd.config.babel.js",
"changelog": "auto-changelog --template keepachangelog -p && git add CHANGELOG.md",
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --progress --config webpack.config.babel.js",
"format": "prettier --write 'src/**/*.js'",
"format-preview": "prettier --list-different 'src/**/*.js'",
"format": "prettier --write 'src/**/*.js' '*.js'",
"format-preview": "prettier --list-different 'src/**/*.js' '*.js'",
"prebuild": "rimraf build && mkdirp build",
"prepublish": "run-s build",
"prestart": "run-s build",
Expand Down
4 changes: 2 additions & 2 deletions src/foo.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<% for (var chunk in htmlWebpackPlugin.files.css) { %>
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[chunk] %>">
<% } %>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
<script src="<%= htmlWebpackPlugin.files.js[chunk] %>"></script>
<% } %>
<meta charset="utf-8">
<title>Netlify Identity Widget</title>
Expand Down
4 changes: 2 additions & 2 deletions src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<% for (var chunk in htmlWebpackPlugin.files.css) { %>
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[chunk] %>">
<% } %>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
<script src="<%= htmlWebpackPlugin.files.js[chunk] %>"></script>
<% } %>
<meta charset="utf-8">
<title>Netlify Identity Widget</title>
Expand Down
47 changes: 7 additions & 40 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import postCSSImport from "postcss-import";
import postCSSNested from "postcss-nested";
import postCSSNext from "postcss-cssnext";
import path from "path";
const ENV = process.env.NODE_ENV || "development";

const CSS_MAPS = ENV !== "production";
const ENV = process.env.NODE_ENV || "development";
const isProduction = ENV === "production";
const CSS_MAPS = !isProduction;

module.exports = {
context: path.resolve(__dirname, "src"),
mode: isProduction ? "production" : "development",
entry: {
"netlify-identity-widget": "./index.js"
},
Expand Down Expand Up @@ -65,7 +67,7 @@ module.exports = {
},
{
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
use: ENV === "production" ? "file-loader" : "url-loader"
use: isProduction ? "file-loader" : "url-loader"
}
]
},
Expand All @@ -87,42 +89,7 @@ module.exports = {
inject: false,
minify: { collapseWhitespace: true }
})
].concat(
ENV === "production"
? [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
output: {
comments: false
},
compress: {
unsafe_comps: true,
properties: true,
keep_fargs: false,
pure_getters: true,
collapse_vars: true,
unsafe: true,
warnings: false,
screw_ie8: true,
sequences: true,
dead_code: true,
drop_debugger: true,
comparisons: true,
conditionals: true,
evaluate: true,
booleans: true,
loops: true,
unused: true,
hoist_funs: true,
if_return: true,
join_vars: true,
cascade: true,
drop_console: false
}
})
]
: []
),
],

stats: { colors: true },

Expand All @@ -135,7 +102,7 @@ module.exports = {
setImmediate: false
},

devtool: ENV === "production" ? "source-map" : "cheap-module-eval-source-map",
devtool: isProduction ? "source-map" : "cheap-module-eval-source-map",

devServer: {
port: process.env.PORT || 8080,
Expand Down
Loading