weboptimizer 4.0.10 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -4
- package/webpackConfigurator.js +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.12",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -1236,9 +1236,7 @@
|
|
|
1236
1236
|
"nodeENV": null,
|
|
1237
1237
|
"nodeEnvironment": {
|
|
1238
1238
|
"#": "Indicates which node environment variables should be included in built artefacts.",
|
|
1239
|
-
"global": true
|
|
1240
|
-
"__filename": "mock",
|
|
1241
|
-
"__dirname": "mock"
|
|
1239
|
+
"global": true
|
|
1242
1240
|
},
|
|
1243
1241
|
"offline": {
|
|
1244
1242
|
"common": {
|
package/webpackConfigurator.js
CHANGED
|
@@ -78,12 +78,13 @@ Logger.configureAllInstances({
|
|
|
78
78
|
const module = configuration.module;
|
|
79
79
|
// region initialization
|
|
80
80
|
/// region determine library name
|
|
81
|
+
const exportFormatsNeedingAValidVariableName = ['assign', 'global', 'this', 'var', 'window'];
|
|
81
82
|
let libraryName;
|
|
82
83
|
if (configuration.libraryName) libraryName = configuration.libraryName;else if (Object.keys(configuration.injection.entry.normalized).length > 1) libraryName = '[name]';else {
|
|
83
84
|
libraryName = configuration.name;
|
|
84
|
-
if (
|
|
85
|
+
if (exportFormatsNeedingAValidVariableName.includes(configuration.exportFormat.self)) libraryName = convertToValidVariableName(libraryName);
|
|
85
86
|
}
|
|
86
|
-
if (libraryName === '*') libraryName =
|
|
87
|
+
if (libraryName === '*') libraryName = exportFormatsNeedingAValidVariableName.includes(configuration.exportFormat.self) ? Object.keys(configuration.injection.entry.normalized).map(name => convertToValidVariableName(name)) : undefined;
|
|
87
88
|
/// endregion
|
|
88
89
|
/// region plugins
|
|
89
90
|
const pluginInstances = [];
|
|
@@ -704,7 +705,7 @@ if (configuration.files.compose.cascadingStyleSheet && plugins.MiniCSSExtract) {
|
|
|
704
705
|
So we inject live reload and hot module replacement manually.
|
|
705
706
|
*/
|
|
706
707
|
if (htmlAvailable && configuration.debug && configuration.development.server.liveReload && !Object.prototype.hasOwnProperty.call(configuration.injection.entry.normalized, 'developmentHandler') && (configuration.development.includeClient || typeof configuration.development.includeClient !== 'boolean' && ['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2]))) {
|
|
707
|
-
configuration.injection.entry.normalized.developmentHandler = ['webpack-dev-server/client/index.js?' + 'live-reload=true' + `&hot=${configuration.development.server.hot ? 'true' : 'false'}` + `&http${configuration.development.server.https ? 's' : ''}://` + `${configuration.development.server.host}
|
|
708
|
+
configuration.injection.entry.normalized.developmentHandler = ['webpack-dev-server/client/index.js?' + 'live-reload=true' + `&hot=${configuration.development.server.hot ? 'true' : 'false'}` + `&http${configuration.development.server.https ? 's' : ''}://` + `${configuration.development.server.host}:` + String(configuration.development.server.port)];
|
|
708
709
|
if (configuration.development.server.hot) {
|
|
709
710
|
configuration.injection.entry.normalized.developmentHandler.push('webpack/hot/dev-server.js');
|
|
710
711
|
configuration.development.server.hot = false;
|
|
@@ -848,7 +849,7 @@ export let webpackConfiguration = extend(true, {
|
|
|
848
849
|
if (configuration.nodeENV !== null) if (typeof webpackConfiguration.optimization === 'object') webpackConfiguration.optimization.nodeEnv = configuration.nodeENV;else webpackConfiguration.optimization = {
|
|
849
850
|
nodeEnv: configuration.nodeENV
|
|
850
851
|
};
|
|
851
|
-
if (!Array.isArray(module.skipParseRegularExpressions) || module.skipParseRegularExpressions.length) if (typeof webpackConfiguration.module === 'object') webpackConfiguration.module.noParse = module.skipParseRegularExpressions;else webpackConfiguration.module = {
|
|
852
|
+
if (module.skipParseRegularExpressions && !Array.isArray(module.skipParseRegularExpressions) || module.skipParseRegularExpressions.length) if (typeof webpackConfiguration.module === 'object') webpackConfiguration.module.noParse = module.skipParseRegularExpressions;else webpackConfiguration.module = {
|
|
852
853
|
noParse: module.skipParseRegularExpressions
|
|
853
854
|
};
|
|
854
855
|
if (configuration.path.configuration.javaScript) try {
|