Skip to content
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

Make both production and development builds available #509

Merged
merged 1 commit into from
Dec 4, 2023
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
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
"npm": ">=9"
},
"scripts": {
"build": "webpack --mode=production",
"copy": "cp \"src/docs/_assets/generated/react-ui.css\" dist & cp \"src/docs/_assets/generated/react-ui.js\" dist",
"build": "webpack --mode=production && webpack --mode=development",
"copy": "npm run copy:css && npm run copy:js",
"copy:css": "cp src/docs/_assets/generated/react-ui.css dist && cp src/docs/_assets/generated/react-ui.development.css dist",
"copy:js": "cp src/docs/_assets/generated/react-ui.js dist && cp src/docs/_assets/generated/react-ui.development.js dist",
"eslint": "eslint --ext js,jsx src",
"jest": "jest src --coverage",
"lint": "npm run eslint && npm run markdownlint && npm run stylelint",
Expand Down
14 changes: 10 additions & 4 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ module.exports = (env, argv) => ({
],
},
optimization: {
minimize: true,
minimize: argv.mode === 'production',
minimizer: [new TerserPlugin()],
},
output: {
filename: '[name].js',
filename: argv.mode === 'production'
? '[name].js'
: '[name].development.js',
libraryTarget: 'umd',
path: Path.join(__dirname, 'src/docs/_assets/generated/'),
},
Expand All @@ -84,8 +86,12 @@ module.exports = (env, argv) => ({
},
plugins: [
new MiniCssExtractPlugin({
chunkFilename: '[id].css',
filename: '[name].css',
chunkFilename: argv.mode === 'production'
? '[id].css'
: '[id].development.css',
filename: argv.mode === 'production'
? '[name].css'
: '[name].development.css',
ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
new StyleLintPlugin({
Expand Down