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

Add support for Webpack 5 and drop previous versions #390

Merged
merged 4 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ scalaJSUseMainModuleInitializer := true

//#relevant-settings
npmDependencies in Compile ++= Seq(
"moment" -> "2.18.1"
"moment" -> "2.29.1"
)

npmDevDependencies in Compile ++= Seq(
"webpack-merge" -> "4.1.2",
"imports-loader" -> "0.8.0",
"expose-loader" -> "0.7.5"
"webpack-merge" -> "5.7.3",
"imports-loader" -> "2.0.0",
"expose-loader" -> "2.0.0"
)

webpackConfigFile in fastOptJS := Some(baseDirectory.value / "dev.webpack.config.js")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@ const importRule = {
// Force require global modules
test: /.*-(fast|full)opt\.js$/,
loader:
"imports-loader?" +
Object.keys(globalModules)
"imports-loader",
options: {
type: 'commonjs',
imports: Object.keys(globalModules)
.map(function(modName) {
return modName + "=" + globalModules[modName];
return {
moduleName: globalModules[modName],
name: modName,
}
})
.join(",")
}
};

const exposeRules = Object.keys(globalModules).map(function(modName) {
// Expose global modules
return {
test: require.resolve(modName),
loader: "expose-loader?" + globalModules[modName]
loader: "expose-loader",
options: {
exposes: [globalModules[modName]],
},
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var merge = require('webpack-merge');
var { merge } = require('webpack-merge');

var commonConfig = require('./common.webpack.config');
var generatedConfig = require('./scalajs.webpack.config');

module.exports = merge(generatedConfig, commonConfig);
module.exports = merge(generatedConfig, commonConfig);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var merge = require('webpack-merge');
var { merge } = require('webpack-merge');

var commonConfig = require('./common.webpack.config');
var commonConfig = require('./common.webpack.config');

module.exports = merge(commonConfig, {});
module.exports = merge(commonConfig, {});
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ TaskKey[Unit]("checkArchive") := {
"assets/webpack-assets-opt-bundle.js",
"assets/webpack-assets-opt-loader.js",
"assets/webpack-assets-opt-library.js",
"assets/webpack-assets-opt-library.js.map",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.map files are now in related assets, which are not extracted (yet)

"assets/webpack-assets-opt.js",
"assets/react.production.min.js",
"assets/react-dom.production.min.js"
Expand Down