Skip to content

Commit

Permalink
Merge a7048d6 into 566a077
Browse files Browse the repository at this point in the history
  • Loading branch information
homer0 committed Dec 29, 2019
2 parents 566a077 + a7048d6 commit 0ecd928
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 256 deletions.
3 changes: 0 additions & 3 deletions package.json
Expand Up @@ -13,9 +13,6 @@
"fs-extra": "^8.1.0",
"extend": "^3.0.2",

"core-js": "^3.6.1",
"regenerator-runtime": "0.13.3",

"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
Expand Down
3 changes: 0 additions & 3 deletions polyfill.js

This file was deleted.

1 change: 0 additions & 1 deletion src/index.js
Expand Up @@ -38,7 +38,6 @@ const loadPlugin = (app) => {
'express',
'jimpex',
],
babelPolyfill: 'polyfill.js',
}));
// Register the main services of the build engine.
app.register(webpackConfiguration);
Expand Down
21 changes: 3 additions & 18 deletions src/services/building/configuration.js
Expand Up @@ -16,17 +16,14 @@ class WebpackConfiguration {
* configuration for the target.
* @param {WebpackConfigurations} webpackConfigurations A dictionary of configurations
* for target type and build type.
* @param {WebpackPluginInfo} webpackPluginInfo To get the path to the Babel
* polyfill.
*/
constructor(
buildVersion,
pathUtils,
targets,
targetsFileRules,
targetConfiguration,
webpackConfigurations,
webpackPluginInfo
webpackConfigurations
) {
/**
* A local reference for the `buildVersion` service.
Expand Down Expand Up @@ -58,11 +55,6 @@ class WebpackConfiguration {
* @type {WebpackConfigurations}
*/
this.webpackConfigurations = webpackConfigurations;
/**
* A local reference for the plugin information.
* @type {WebpackPluginInfo}
*/
this.webpackPluginInfo = webpackPluginInfo;
}
/**
* This method generates a complete webpack configuration for a target.
Expand All @@ -86,12 +78,6 @@ class WebpackConfiguration {
throw new Error(`There's no configuration for the selected build type: ${buildType}`);
}

const entryFile = path.join(target.paths.source, target.entry[buildType]);
const entries = [entryFile];
if (target.babel.polyfill) {
entries.unshift(`${this.webpackPluginInfo.name}/${this.webpackPluginInfo.babelPolyfill}`);
}

const copy = [];
if (target.is.browser || target.bundle) {
copy.push(...this.targets.getFilesToCopy(target, buildType));
Expand All @@ -109,7 +95,7 @@ class WebpackConfiguration {
target,
targetRules: this.targetsFileRules.getRulesForTarget(target),
entry: {
[target.name]: entries,
[target.name]: [path.join(target.paths.source, target.entry[buildType])],
},
definitions,
output,
Expand Down Expand Up @@ -288,8 +274,7 @@ const webpackConfiguration = provider((app) => {
app.get('targets'),
app.get('targetsFileRules'),
app.get('targetConfiguration'),
webpackConfigurations,
app.get('webpackPluginInfo')
webpackConfigurations
);
});
});
Expand Down
13 changes: 2 additions & 11 deletions src/services/configurations/browserDevelopmentConfiguration.js
Expand Up @@ -240,17 +240,8 @@ class WebpackBrowserDevelopmentConfiguration extends ConfigurationFile {
const [entryName] = Object.keys(entry);
// Get the list of entries for the target.
const entries = config.entry[entryName];
// Check if the Babel polyfill is present, since it always needs to be first.
const polyfillIndex = entries
.indexOf(`${this.webpackPluginInfo.name}/${this.webpackPluginInfo.babelPolyfill}`);
// If the `babel-polyfill` is present...
if (polyfillIndex > -1) {
// ...push all the _"hot entries"_ after it.
entries.splice(polyfillIndex + 1, 0, ...hotEntries);
} else {
// ...push all the _"hot entries"_ on top of the existing entries.
entries.unshift(...hotEntries);
}
// and push all the _"hot entries"_ on top of the existing entries.
entries.unshift(...hotEntries);
}

// Reduce the configuration
Expand Down
2 changes: 0 additions & 2 deletions src/typedef.js
Expand Up @@ -179,8 +179,6 @@
* @property {Array} external The list of subpaths the plugin exposes and that should be
* handled as external dependencies, in order to avoid bundling
* them.
* @property {string} babelPolyfill The name of the file that imports the required modules to
* act as the old Babel polyfill.
*/

/**
Expand Down
1 change: 0 additions & 1 deletion tests/index.test.js
Expand Up @@ -31,7 +31,6 @@ describe('plugin:projextWebpack', () => {
'express',
'jimpex',
],
babelPolyfill: 'polyfill.js',
});
expect(app.set).toHaveBeenCalledTimes(1);
expect(app.set).toHaveBeenCalledWith('webpackPluginInfo', expect.any(Function));
Expand Down

0 comments on commit 0ecd928

Please sign in to comment.