Skip to content

Commit

Permalink
build: npm run webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick committed Jul 26, 2023
1 parent 8d49a86 commit 46e5624
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "0.1.0",
"repository": "https://github.com/openedx/edx-platform",
"scripts": {
"postinstall": "scripts/copy-node-modules.sh"
"postinstall": "scripts/copy-node-modules.sh",
"webpack": "NODE_ENV=${NODE_ENV:-production} \"$(npm bin)/webpack\" --config=${WEBPACK_CONFIG_PATH:-webpack.prod.config.js}",
"webpack-dev": "NODE_ENV=development \"$(npm bin)/webpack\" --config=webpack.dev.config.js"
},
"dependencies": {
"@babel/core": "7.19.0",
Expand Down
10 changes: 7 additions & 3 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var defineFooter = new RegExp('(' + defineCallFooter.source + ')|('
+ defineDirectFooter.source + ')|('
+ defineFancyFooter.source + ')', 'm');

var staticRootLms = process.env.STATIC_ROOT_LMS || "./test_root/staticfiles";
var staticRootCms = process.env.STATIC_ROOT_CMS || (staticRootLms + "/studio");

var workerConfig = function() {
try {
return {
Expand All @@ -39,7 +42,7 @@ var workerConfig = function() {
},
plugins: [
new BundleTracker({
path: process.env.STATIC_ROOT_LMS,
path: staticRootLms,
filename: 'webpack-worker-stats.json'
}),
new webpack.DefinePlugin({
Expand Down Expand Up @@ -131,14 +134,15 @@ module.exports = Merge.smart({
},

plugins: [
new webpack.ProgressPlugin(), // report progress during compilation
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new BundleTracker({
path: process.env.STATIC_ROOT_CMS,
path: staticRootCms,
filename: 'webpack-stats.json'
}),
new BundleTracker({
path: process.env.STATIC_ROOT_LMS,
path: staticRootLms,
filename: 'webpack-stats.json'
}),
new webpack.ProvidePlugin({
Expand Down
2 changes: 1 addition & 1 deletion webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = _.values(Merge.smart(commonConfig, {
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.JS_ENV_EXTRA_CONFIG': process.env.JS_ENV_EXTRA_CONFIG
'process.env.JS_ENV_EXTRA_CONFIG': process.env.JS_ENV_EXTRA_CONFIG || "{}"
})
],
module: {
Expand Down
2 changes: 1 addition & 1 deletion webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var optimizedConfig = Merge.smart(commonConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.JS_ENV_EXTRA_CONFIG': process.env.JS_ENV_EXTRA_CONFIG
'process.env.JS_ENV_EXTRA_CONFIG': process.env.JS_ENV_EXTRA_CONFIG || "{}"
}),
new webpack.LoaderOptionsPlugin({ // This may not be needed; legacy option for loaders written for webpack 1
minimize: true
Expand Down

0 comments on commit 46e5624

Please sign in to comment.