Skip to content

Commit

Permalink
updgrade to webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
redallen committed Jan 27, 2021
1 parent d960fef commit 8a80dd2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions config/webpack.config.js
Expand Up @@ -14,7 +14,7 @@ const commonConfig = ({
filename: `chrome${noHash ? '' : '.[chunkhash]'}.js`,
publicPath,
chunkFilename: `[name]${noHash ? '' : '.[chunkhash]'}.js`,
jsonpFunction: 'wpJsonpChromeInstance'
//jsonpFunction: 'wpJsonpChromeInstance'
},
resolve: {
alias: {
Expand All @@ -23,6 +23,11 @@ const commonConfig = ({
reactRedux: path.resolve(__dirname, './react-redux-external.js'),
'react-router-dom': path.resolve(__dirname, './react-router-dom-externals.js'),
PFReactCore: path.resolve(__dirname, './patternfly-react-externals.js')
},
fallback: {
stream: require.resolve("stream-browserify"),
path: require.resolve("path-browserify"),
zlib: require.resolve("browserify-zlib")
}
},
optimization: {
Expand Down Expand Up @@ -51,11 +56,6 @@ const commonConfig = ({
}
]
},
{
parser: {
amd: false
}
}
]
},
plugins
Expand Down
2 changes: 0 additions & 2 deletions config/webpack.plugins.js
Expand Up @@ -2,11 +2,9 @@ const webpack = require('webpack');
const LodashWebpackPlugin = require('lodash-webpack-plugin');
const WriteFileWebpackPlugin = require('write-file-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

const plugins = [
new CleanWebpackPlugin(),
new HardSourceWebpackPlugin(),
new WriteFileWebpackPlugin(),
new webpack.SourceMapDevToolPlugin({
test: /\.js/i,
Expand Down
26 changes: 14 additions & 12 deletions package.json
Expand Up @@ -5,17 +5,17 @@
"main": "index.js",
"scripts": {
"start": "NODE_ENV=development npm run watch",
"analyze:js": "NODE_ENV=production webpack --config config/webpack.config.js --env.analyze=true --env.publicPath=/apps/chrome/js/ --mode=production",
"analyze:js": "NODE_ENV=production webpack --config config/webpack.config.js --env analyze=true --env publicPath=/apps/chrome/js/ --mode=production",
"build": "NODE_ENV=production npm run build:js -- --mode=production && npm-run-all build:images-chrome build:sass clean:chrome hash:chrome build:pug build:fonts build:Fafonts",
"build:beta": "NODE_ENV=production npm run build:js:beta -- --mode=production && npm-run-all build:images-chrome build:sass clean:chrome hash:chrome build:pug:beta build:fonts build:Fafonts",
"build:js": "webpack --config config/webpack.config.js --env.publicPath=/apps/chrome/js/",
"build:js:beta": "webpack --config config/webpack.config.js --env.publicPath=/beta/apps/chrome/js/",
"build:js": "webpack --config config/webpack.config.js --env publicPath=/apps/chrome/js/",
"build:js:beta": "webpack --config config/webpack.config.js --env publicPath=/beta/apps/chrome/js/",
"build:images-chrome": "mkdir -p build/assets/images && ncp static/images build/assets/images",
"build:pug": "node ./scripts/build-pug.js insights",
"build:pug:beta": "node ./scripts/build-pug.js insightsbeta",
"build:sass": "node-sass src/sass/chrome.scss --importer node_modules/node-sass-package-importer/dist/cli.js -o build/",
"build:fonts": "mkdir -p build/assets/fonts && ncp node_modules/@patternfly/patternfly/assets/fonts build/assets/fonts",
"build:Fafonts": "mkdir -p build/assets/fonts && ncp node_modules/font-awesome/fonts build/assets/fonts",
"build:sass": "node-sass src/sass/chrome.scss --importer ../../node_modules/node-sass-package-importer/dist/cli.js -o build/",
"build:fonts": "mkdir -p build/assets/fonts && ncp ../../node_modules/@patternfly/patternfly/assets/fonts build/assets/fonts",
"build:Fafonts": "mkdir -p build/assets/fonts && ncp ../../node_modules/font-awesome/fonts build/assets/fonts",
"clean:chrome": "del build/chrome.*.css",
"hash:chrome": "contentHash=$(md5-file build/chrome.css) && ncp build/chrome.css build/chrome.$contentHash.css && del build/chrome.css",
"fixjs": "eslint src --fix",
Expand All @@ -26,9 +26,9 @@
"test:update": "jest --updateSnapshot",
"verify": "npm-run-all lint build test",
"verify:beta": "npm-run-all lint build:beta test",
"watch": "npm run build:js -- --mode=development --env.noHash=true && npm run build:sass && npm run build:pug -- nohash && npm-run-all --parallel watch:*",
"watch": "npm run build:js -- --mode=development --env noHash=true && npm run build:sass && npm run build:pug -- nohash && npm-run-all --parallel watch:*",
"watch:images": "npm run build:images-chrome -- -w",
"watch:js": "npm run build:js -- --watch --mode=development --env.noHash=true",
"watch:js": "npm run build:js -- --watch --mode=development --env noHash=true",
"watch:sass": "npm run build:sass -- -w",
"nightly": "npm run build"
},
Expand Down Expand Up @@ -99,7 +99,6 @@
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-react": "^7.20.0",
"file-loader": "^6.0.0",
"hard-source-webpack-plugin": "^0.13.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.0.1",
"jest-fetch-mock": "^3.0.3",
Expand All @@ -125,9 +124,9 @@
"terser-webpack-plugin": "^4.2.2",
"to-string-loader": "^1.1.6",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.44.2",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^3.3.12",
"webpack": "^5.0.0",
"webpack-bundle-analyzer": "^4.0.0",
"webpack-cli": "^4.0.0",
"webpack-merge": "^4.2.2",
"write-file-webpack-plugin": "^4.5.1"
},
Expand Down Expand Up @@ -159,6 +158,7 @@
"babel-plugin-rewire": "^1.2.0",
"babel-preset-es2015": "^6.24.1",
"broadcast-channel": "^3.1.0",
"browserify-zlib": "^0.2.0",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"enzyme-adapter-react-16": "^1.15.2",
Expand All @@ -173,13 +173,15 @@
"lodash": "^4.17.15",
"md5-file": "^5.0.0",
"node-fetch": "^2.6.1",
"path-browserify": "^1.0.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-test-renderer": "^16.13.1",
"redux": "^4.0.5",
"redux-promise-middleware": "^6.1.2",
"stream-browserify": "^3.0.0",
"urijs": "^1.19.5",
"url-parse": "^1.4.7"
},
Expand Down

0 comments on commit 8a80dd2

Please sign in to comment.