Skip to content

Commit

Permalink
build(webpack): upgrade to webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Rötsch authored and axe312ger committed Feb 27, 2018
1 parent 6e0a653 commit 2cc40fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@
"sinon": "^4.4.2",
"tap-spec": "^4.1.1",
"trevor": "^2.2.0",
"webpack": "^3.3.0",
"webpack-bundle-analyzer": "^2.11.0"
"webpack": "^4.0.0",
"webpack-bundle-analyzer": "^2.11.0",
"webpack-cli": "^2.0.9"
},
"engines": {
"node": ">=6"
Expand Down
9 changes: 5 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if (PROD) {
const baseFileName = `contentful`

const baseBundleConfig = {
mode: PROD ? 'production' : 'development',
context: path.join(__dirname, 'lib'),
entry: [`./${baseFileName}.js`],
output: {
Expand All @@ -41,7 +42,7 @@ const baseBundleConfig = {
library: 'contentful'
},
module: {
loaders: []
rules: []
},
devtool: PROD ? false : 'source-map',
plugins,
Expand All @@ -62,7 +63,7 @@ const defaultBabelLoader = {

// Browsers
const browserBundle = clone(baseBundleConfig)
browserBundle.module.loaders = [
browserBundle.module.rules = [
Object.assign({}, defaultBabelLoader, {
options: Object.assign({}, defaultBabelLoader.options, {
forceEnv: 'browser'
Expand All @@ -73,7 +74,7 @@ browserBundle.output.filename = `${baseFileName}.browser${PROD ? '.min' : ''}.js

// Legacy browsers like IE11
const legacyBundle = clone(baseBundleConfig)
legacyBundle.module.loaders = [
legacyBundle.module.rules = [
Object.assign({}, defaultBabelLoader, {
options: Object.assign({}, defaultBabelLoader.options, {
forceEnv: 'legacy'
Expand All @@ -95,7 +96,7 @@ legacyBundle.output.filename = `${baseFileName}.legacy${PROD ? '.min' : ''}.js`

// Node
const nodeBundle = clone(baseBundleConfig)
nodeBundle.module.loaders = [
nodeBundle.module.rules = [
Object.assign({}, defaultBabelLoader, {
options: Object.assign({}, defaultBabelLoader.options, {
forceEnv: 'node'
Expand Down

0 comments on commit 2cc40fe

Please sign in to comment.