Navigation Menu

Skip to content

Commit

Permalink
BREAKING: webpack-cli v3 (#448)
Browse files Browse the repository at this point in the history
* chore(monorepo): move to lerna

* chore(monorepo): use commands as normal instead of package

* fix(revert): packagejson

* chore(monorepo): prune files and update eslint rules

* chore(monorepo): fix the no-missing-require error

* chore(monorepo): fix typo

* chore(monorepo): fix typo

* chore(monorepo): prune package json

* chore(monorepo): merge package lock json

* chore(monorepo): updated package.json

* chore(monorepo): fix plugin package.json

* chore(cli): move to lerna and scoped packages (#434)

* fix(loader,plugin): fix generators path bug

* cli(refactor): improve folder structure (#371)

* cli(refactor): improve folder structure

* chore(linting): fix linter errors

* cli(filepath): use local import instead

* cli(migrate): refactor error handling

* chore(review): fix review comments

* chore(review): fix review comments

* chore(review): fix review comments

* chore(version): v.2.0.14

* Add break as commit type and listed the type of commit in the documentation (#379)

* docs(commits): listed the list of type of commits available

* cli(init): mode support to config (#364)

* cli(init): mode support to config

* cli(bugfix): Allow mode "none" in CLI (#381)

* cli(init): use extractMiniCSSPlugin (#363)

* cli(init): skip redundant question

* cli(init): use mini-css-extract-plugin

* Retrieve information for CLI option from webpack schema options file (#392)

* cli(refactor): fetch available modes directly from webpack options schema

* cli(refactor): Retrieve information from webpackOptionSchema

* cli(add): write configuration to yeoman file (#348)

* misc(add): variable parity, prettify

* cli(add): write config to yeoman-rc

* misc(add): improve generator questions

* fix(init): output file name for single output (#403)

improved output filename

* cli(migrate): Update migration question (#402)

* cli(init): webpack4 ready (#356)

* cli(init): webpack4 ready

* cli(init): remove unused variable, still @next on etwp

* cli(init): Allow to use default entry in `init`

* cli(init): Fix typo in comment

* cli(init): Optimization transform and tests

* cli(init): Fix non-optimized option for splitChunks

* cli(init): Add cachingGroup per entry, don't show name in prod

* cli(init): Add cachingGroup's defaults, fix entry

* cli(init): Add a link to where the defaults live

* cli(init): Remove default caching group definition from example

* Add NoEmitOnErrorsPlugin transformation (#399)

* ast(migrate): handle no emit on error

* ast(migrate): handle module concatenation and named modules

* ast(migrate): handle module concatenation and named modules

* fix(ast): checks validity of an identifier (#360)

added test cases for validate identifier

* cli(entry): quotes sanitization (#337)

* chore: minor doc fixes

* cli(entry): quotes sanitization

* tests(entry): add test case for double quotes

* tests(entry): update snapshots

* misc(utils): entry - variable parity

* misc(prop-types): sort

* cli(entry): multiple entries quotes sanitization

* chore(versioning): v 2.0.15

* chore(versioning): push new package version

* cli(fix): remove reference to specific version during migration (#410)

* fix: remove reference to specific version during migration

* fix: rephrase update message

* chore(docs): updated old references to the extract text plugin (#412)

* chore(dev): added break to the list of type of commit

* init(fix): removed references to extract text plugin

* fix(commit): rollback

* cli(migration): update UglifyJS transformation (#416)

* cli(migration): Update UglifyJS migration file to fit webpack4 configuration

* cli(migration): Add cases where require variable does not need to exist

* cli(migration): Add transformation for usage of webpack.otimization.UglifyPlugin

* cli(tests): Update test snapshots after updating transformation

* cli(fix): fix expressionContent being null

* cli(refactor): remove plugins array if empty

Created function on ast-utils so every other transformation can use this.

* tests: add tests for new ast-utils method

* fix: fix test names and jsdoc

* fix: update maxSize for utils folder

* ast(cli): Recursively parse AST (#341)

* ast(refactor): wip refactor

* ast(refactor): wip refactor

* ast(init): refactor

* test(refactor): refactor test suite

* tests(define): swap args

* ast(parsing): refactor stuff

* ast(init): refactor

* ast(init): refactor tests

* chore(tests): remove some unneeded tests

* chore(pkg): update package.json

* chore(project): clear up project structure

* chore(cli): remove unneded files

* chore(git): add gitignore to yeoman file

* chore(deps): update pkg.json

* tests(snapshots): update snapshots

* tests(jest): use empty module for snapshots

* tests(snap): only test one prop

* chore(publishing): add semantic-release (#415)

* chore(release): [WIP] add semantic-release

* test(ci): wip

* test(ci): add node versions

* test(ci): remove extra test

* tests(ci): revise

* tests(ci): only push to npm on master

* tests(ci): use matrix on jobs

* tests(ci): revise

* tests(ci): update

* tests(ci): test

* tests(ci): test

* tests(ci): p

* tests(ci): update travis.yml

* chore(release): revise travis

* misc(yeoman): update yeoman

* chore(travis): revise travis

* misc(travis): revise travis.yml

* chore(travis): remove redundant code

* chore(pkg): add keywords

* 2.1.1

* 2.1.2

* cli(cmds): revise yargs command (#422)

* use yargs.command instead of yargs.option for sub-commands

* cli(node): Add node flags to CLI (#377)

* feat: add support for node flags

* tests: Fix node-flags test

* misc: Fix test failing due to not-found webpack-cli

* misc: remove comment

* misc: refactor removing unecessary args

* tests: add more tests to prevent argument collision

* cli(cmds): remove strict

* fix(node): remove node option for now

* chore(lerna): refactor

* chore(lerna): refactor

* chore(refactor): refactor stuff

* chore(package): update pkg.lock

* chore(templates): Update issue templates (#432)

Adds fancy templates

* ast(init): add topScope prop

* ast(merge): re-add merge prop

* cli(lerna): refactor

* chore(lerna): refactor

* chore(lerna): update

* chore(lint): revise

* chore(refactor): refactor

* chore(tests): use lerna for tests

* chore(travis): don't cache me outside

* chore(pkg): remove prefer global

* chore(release): v.2.1.3

* chore(package.lock): update pkg.lock

* fix(loader,plugin): fix generators path bug

* chore(version): v.2.0.14

* Add break as commit type and listed the type of commit in the documentation (#379)

* docs(commits): listed the list of type of commits available

* cli(bugfix): Allow mode "none" in CLI (#381)

* cli(init): use extractMiniCSSPlugin (#363)

* cli(init): skip redundant question

* cli(init): use mini-css-extract-plugin

* Retrieve information for CLI option from webpack schema options file (#392)

* cli(refactor): fetch available modes directly from webpack options schema

* cli(refactor): Retrieve information from webpackOptionSchema

* cli(add): write configuration to yeoman file (#348)

* misc(add): variable parity, prettify

* cli(add): write config to yeoman-rc

* misc(add): improve generator questions

* fix(init): output file name for single output (#403)

improved output filename

* cli(migrate): Update migration question (#402)

* fix(ast): checks validity of an identifier (#360)

added test cases for validate identifier

* chore(versioning): v 2.0.15

* chore(versioning): push new package version

* cli(fix): remove reference to specific version during migration (#410)

* fix: remove reference to specific version during migration

* fix: rephrase update message

* chore(docs): updated old references to the extract text plugin (#412)

* chore(dev): added break to the list of type of commit

* init(fix): removed references to extract text plugin

* fix(commit): rollback

* misc(yeoman): update yeoman

* cli(cmds): revise yargs command (#422)

* use yargs.command instead of yargs.option for sub-commands

* cli(node): Add node flags to CLI (#377)

* feat: add support for node flags

* tests: Fix node-flags test

* misc: Fix test failing due to not-found webpack-cli

* misc: remove comment

* misc: refactor removing unecessary args

* tests: add more tests to prevent argument collision

* cli(cmds): remove strict

* fix(node): remove node option for now

* chore(templates): Update issue templates (#432)

Adds fancy templates

* cli(lerna): refactor

* chore(lerna): refactor

* chore(pkg): remove prefer global

* chore(travis): Add encrypted private ssh key

* fix(pkg): test auto setup

* cli(init): revise installation steps (#441)

* cli(init): revise installation steps

* chore(formatting): format code

* cli(tests): refactor tests

* chore(travis): run lockfile cmds on tests (#444)

* Update dependencies to enable Greenkeeper 🌴 (#443)

chore(greenkeeper): Update dependencies to enable Greenkeeper 🌴

* chore(docs): update readme

* chore(travis): add Node.js 10 (#425)

* chore(travis): move npm ci to install task (#424)

* chore(travis): move npm ci to install task

* chore: trigger new build

* chore: upgrade Node.js for Appveyor to 8

* chore: remove redundanct npm install command

* chore(linting): resolve linter errors

* chore(linting): fix linting errors

* chore(linting): resolve linting

* chore(linting): resolve linting

* chore(scaffold): move addons to scaffold

* chore(scaffold): fix linting errors

* cli(prompt): initial comment for prompt file

* cli(prompt): wip

* fix(monorepo): fix lint errors

* fix(monorepo): fix cross spawn versions

* fix(monorepo): update lock files

* fix(monorepo): fix versions in pacakges

* chore(rebase): refactor stuff

* cli(pkgs): re-add entries

* chore(v): revise pkg

* v0.0.1

* chore(v): revise some deps

* v0.0.2

* v0.0.3

* chore(v): back to v1

* v0.0.2

* v0.0.3

* v0.0.4

* chore(deps): update deps

* chore(prompt): revise prompt cmd

* v0.0.5

* cli(path): resolve better

* v0.0.6

* chore(v.6): update init

* chore(pkg): v.6 on next

* chore(monorepo): add bootstrap to run

chore(monorepo): add bootstrap to ci

* chore(monorepo): fix appveyor build

* chore(monorepo): fix appveyor build

* chore(monorepo): add eslint-plugin-prettier

* chore(monorepo): fix appveyor build

chore(monorepo): fix appveyor build

chore(monorepo): add eslint-plugin-prettier

chore(monorepo): use nohoist

* chore(monorepo): fix versions and use clean bootstrap

* chore(monorepo): add rimraf globally

chore(monorepo): revert back

* chore(monorepo): fix windows build

* cli(color): don't use color on non-tty (#452)

* Added yarn lock file to gitignore (#455)

* chore(next): dev version bump

* chore(monorepo): fix windows build

* cli(symlinks): Fix paths (#453)

* cli(symlinks): fix symlinks

* chore(linting): resolve linting errors

* chore(rebase): remove old file

* cli(init): Better defaults (#451)

* cli(init): set default generator name

* cli(init): better defaults

* chore(rebase): remove old commit

* cli(init): fix broken ast and merge scaffolds

* chore(docs): better defaults

* chore(lint): fix linting errors

* chore(deps): remove path from dep installation

* chore(resolve): resolve conflicts

* fix(vulnerabilities): vulnerabilities patch for v3 (#460)

* chore(dependencies): fix vulnerabilities

* misc(scripts): update clean:all script

* chore(dependencies): fix vulnerabilities

* tests(parser): fix recursive-tests signature (#470)

* chore(deps): add lerna

* tests(coverage): fix coverage (#473)

* test(coverage): fix coverage

* test(binTestCases): run bintestcases on upper-repo

* tests(travis): add node 10

* tests(cov): use regular nyc on tests

* chore(lockfile): update pkglock

* chore(semantic): configure plugins (#475)

* fix(cli): show help flag when defaults fail (#466)

* fixed test cases

* remove unwanted console

* fix(254) - addressed PR comments

* fix(254) - added requested changes at right place

* fix(254) - exit after error

exit webpack if defaults are not found
fix test cases for no options

* fix: require chalk

* refactor - addressed PR comments

* refactor - addressed PR comments

* refactor : remove unwanted keywords

* chore(review): format

* tests(no-options): refactor tests

* ast(parser): add (#456)

* ast(parser): add, update, remove - literal node support

* ast(parser): add command

* ast(util): update property, early exit

* tests(add): resursive add ast

* tests(add): update recursive parser snaps

* misc(conflicts): resolve conflicts

* tests(parser): update tests, inputs

* chore(review): fix some things

* ast(utils): add ast-path safe traverse and type support

* ast(utils): merge update property with add property

* tests(ast): add tests for safe traversals

* misc(fixes): review comments

* tests(ast): add tests for addProperty

* misc(fixes): review comments

* misc(fixes): review comments

* misc(fixes): review comments

* cli(add): re-add add command
  • Loading branch information
evenstensberg committed Jun 2, 2018
1 parent 03c1969 commit 138adfd
Show file tree
Hide file tree
Showing 331 changed files with 38,467 additions and 30,903 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Expand Up @@ -13,6 +13,7 @@ build: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- npm i -g npm
- npm i
- npm ci
- npm install --global codecov
- npm install eslint-plugin-node@latest --save-dev
Expand Down
32 changes: 30 additions & 2 deletions .eslintrc.js
Expand Up @@ -60,8 +60,16 @@ module.exports = {
"node/no-missing-require": [
"error",
{
"resolvePaths": ["./packages"],
"allowModules": [
"webpack"
"webpack",
"@webpack-cli/generators",
"@webpack-cli/init",
"@webpack-cli/migrate",
"@webpack-cli/utils",
"@webpack-cli/generate-loader",
"@webpack-cli/generate-plugin",
"@webpack-cli/webpack-scaffold"
]
}
],
Expand All @@ -71,7 +79,27 @@ module.exports = {
{
"allowModules": [
"webpack",
"webpack-dev-server"
"webpack-dev-server",
"@webpack-cli/generators",
"@webpack-cli/init",
"@webpack-cli/migrate",
"@webpack-cli/utils",
"@webpack-cli/generate-loader",
"@webpack-cli/generate-plugin",
"@webpack-cli/webpack-scaffold"
]
}
],
"node/no-extraneous-require": [
"error",
{
"allowModules": [
"@webpack-cli/migrate",
"@webpack-cli/generators",
"@webpack-cli/utils",
"@webpack-cli/generate-loader",
"@webpack-cli/generate-plugin",
"@webpack-cli/webpack-scaffold"
]
}
],
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Expand Up @@ -19,11 +19,17 @@ npm-debug.*
yarn-error.log

# Jest Coverage
/coverage
/.nyc_output
coverage
.nyc_output

# Test Compilation
test/js/*

# lerna log
lerna-debug.log

# Yeoman file
.yo-rc.json
.yo-rc.json

# Yarn lock file
yarn.lock
6 changes: 5 additions & 1 deletion .travis.yml
Expand Up @@ -3,6 +3,7 @@ notifications:
email: false
language: node_js
node_js:
- "10"
- "8"
- "7"
- "6"
Expand Down Expand Up @@ -49,6 +50,7 @@ install:
- npm install -g codecov
- npm install -g eslint
- npm install -g greenkeeper-lockfile@1
- lerna bootstrap

before_script: greenkeeper-lockfile-update
after_script: greenkeeper-lockfile-upload
Expand All @@ -60,4 +62,6 @@ jobs:
- stage: NPM release
if: branch = master
node_js: "lts/*"
script: npm run travis-deploy-once "npm run semantic-release"
script:
- npm run changelog
- npm run travis-deploy-once "npm run semantic-release"
10 changes: 1 addition & 9 deletions INIT.md
Expand Up @@ -14,10 +14,6 @@ What we are meaning here, is if you want to provide your bundle a single or mult

This answers to the output directory of your application. The output directory is where servers or your `index.html` will read the generated bundle from.

3. `Are you going to use this in production? (Y/n)`

If you answer `Yes` to this, we add [`MinCssExtractPlugin`](https://github.com/webpack-contrib/mini-css-extract-plugin) to your project. This means that your style files will be separated in production from the bundles where they are used. If you answer `No`, we will not use the plugin, and `Question 6` will be ignored by default.

4. `Will you be using ES2015? (Y/n)`

If you answer `Yes` to this question, we will add [`ES2015`](https://babeljs.io/learn-es2015/) to your webpack configuration, which will allow you to use modern JavaScript in your project.
Expand All @@ -29,8 +25,4 @@ If you use any sort of style in your project, such as [`.less`](http://lesscss.o
6. `If you want to bundle your CSS files, what will you name the bundle? (press
enter to skip)`

If you answered `Yes` to `Question 3`, this will be enabled. The default value for your generated CSS file is `style.[contentHash].css`, which will collect all your `.less`, `.scss` or `.css` into one file. This will make your build faster in production.

7. `Name your 'webpack.[name].js?' [default: 'prod/config']`

If you answered `Yes` to `Question 3`, the default name of your configuration will be `webpack.prod.js`, otherwise it will be `webpack.config.js` if you don't answer. Other good options to answer to this question is: `dev`, `base`, `production` or `development`.
If you indicate based on previous questions that you are using production, this will be enabled. The default value for your generated CSS file is `style.[contentHash].css`, which will collect all your `.less`, `.scss` or `.css` into one file. This will make your build faster in production.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -29,7 +29,7 @@ The `migrate` feature eases the transition from [version 1](http://webpack.githu

The `init` feature allows users to get started with webpack, fast. Through scaffolding, people can create their own configuration in order to faster initialize new projects for various of use cases.

`webpack-cli init webpack-addons-<package>`
`webpack-cli init webpack-scaffold-<package>`

[Read more about scaffolding](SCAFFOLDING.md)

Expand Down
12 changes: 6 additions & 6 deletions SCAFFOLDING.md
Expand Up @@ -8,16 +8,16 @@ Before writing a `webpack-cli` scaffold, think about what you're trying to achie

`webpack-cli` offers an experience that is interactive and you can prompt users for questions (like, "What is your entry point?") to help customize the output accordingly.

## webpack-addons
## webpack-scaffold

[`webpack-addons`](https://github.com/webpack-contrib/webpack-addons) is a utility suite for creating addons. It contains functions that could be of use for creating an addon yourself.
`webpack-scaffold` is a utility suite for creating addons. It contains functions that could be of use for creating an addon yourself.

## webpack-addons-yourpackage
## webpack-scaffold-yourpackage

In order for `webpack-cli` to compile your package, it must be available on npm or on your local filesystem. If you are curious about how you can create your very own `addon`, please read [How do I compose a
webpack-addon?](https://github.com/ev1stensberg/webpack-addons-demo).
In order for `webpack-cli` to compile your package, it must be available on npm or on your local filesystem. If you are curious about how you can create your very own `scaffold`, please read [How do I compose a
webpack-addon?](https://github.com/ev1stensberg/webpack-scaffold-demo).

If the package is on npm, its name must have a prefix of `webpack-addons`.
If the package is on npm, its name must have a prefix of `webpack-scaffold`.

If the package is on your local filesystem, it can be named whatever you want. Pass the path to the package.

Expand Down
43 changes: 34 additions & 9 deletions bin/webpack.js → bin/cli.js
Expand Up @@ -15,13 +15,24 @@
}

require("v8-compile-cache");

// try local module, fallback to global
try {
require.resolve("webpack");
process.webpackModule = require("webpack");
} catch (err) {
const globalPathToWebpack = require("global-modules-path").getPath(
"webpack"
);
process.webpackModule = require(globalPathToWebpack);
}
const ErrorHelpers = require("./errorHelpers");

const NON_COMPILATION_ARGS = [
"init",
"migrate",
/*
"add",
/*
"remove",
"update",
"make",
Expand All @@ -41,9 +52,7 @@
});

if (NON_COMPILATION_CMD) {
// eslint-disable-next-line
require("../lib/index")(NON_COMPILATION_CMD, process.argv);
return;
return require("./prompt-command")(NON_COMPILATION_CMD, ...process.argv);
}

const yargs = require("yargs").usage(`webpack-cli ${
Expand Down Expand Up @@ -81,7 +90,9 @@ For more information, see https://webpack.js.org/api/cli/.`);
type: "boolean",
alias: "colors",
default: function supportsColor() {
return require("supports-color").supportsColor;
if (process.stdout.isTTY === true) {
return require("supports-color").supportsColor;
}
},
group: DISPLAY_GROUP,
describe: "Enables/Disables colors on the console"
Expand Down Expand Up @@ -287,7 +298,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
}

const firstOptions = [].concat(options)[0];
const statsPresetToOptions = require("webpack").Stats.presetToOptions;
const statsPresetToOptions = process.webpackModule.Stats.presetToOptions;

let outputOptions = options.stats;
if (
Expand Down Expand Up @@ -323,7 +334,10 @@ For more information, see https://webpack.js.org/api/cli/.`);
}
});

if (typeof outputOptions.colors === "undefined")
if (
typeof outputOptions.colors === "undefined" &&
process.stdout.isTTY === true
)
outputOptions.colors = require("supports-color").stdout;

ifArg("sort-modules-by", function(value) {
Expand Down Expand Up @@ -429,7 +443,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
outputOptions.buildDelimiter = value;
});

const webpack = require("webpack");
const webpack = process.webpackModule;

let lastHash = null;
let compiler;
Expand All @@ -450,7 +464,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
}

if (argv.progress) {
const ProgressPlugin = require("webpack").ProgressPlugin;
const ProgressPlugin = process.webpackModule.ProgressPlugin;
new ProgressPlugin({
profile: argv.profile
}).apply(compiler);
Expand Down Expand Up @@ -482,6 +496,17 @@ For more information, see https://webpack.js.org/api/cli/.`);
);
} else if (stats.hash !== lastHash) {
lastHash = stats.hash;
if (stats.compilation && stats.compilation.errors.length !== 0) {
const errors = stats.compilation.errors;
if (errors[0].name === "EntryModuleNotFoundError") {
console.error(
"\n\u001b[1m\u001b[31mInsufficient number of arguments or no entry found."
);
console.error(
"\u001b[1m\u001b[31mAlternatively, run 'webpack(-cli) --help' for usage info.\u001b[39m\u001b[22m\n"
);
}
}
const statsString = stats.toString(outputOptions);
const delimiter = outputOptions.buildDelimiter
? `${outputOptions.buildDelimiter}\n`
Expand Down
2 changes: 1 addition & 1 deletion bin/config-yargs.js
@@ -1,4 +1,4 @@
const optionsSchema = require("webpack/schemas/WebpackOptions.json");
const optionsSchema = require("./optionsSchema.json");
const CONFIG_GROUP = "Config options:";
const BASIC_GROUP = "Basic options:";
const MODULE_GROUP = "Module options:";
Expand Down
29 changes: 15 additions & 14 deletions bin/convert-argv.js
Expand Up @@ -3,10 +3,10 @@ const fs = require("fs");
fs.existsSync = fs.existsSync || path.existsSync;
const interpret = require("interpret");
const prepareOptions = require("./prepareOptions");
const webpackConfigurationSchema = require("../schemas/webpackConfigurationSchema.json");
const validateSchema = require("webpack").validateSchema;
const WebpackOptionsValidationError = require("webpack")
.WebpackOptionsValidationError;
const webpackConfigurationSchema = require("./webpackConfigurationSchema.json");
const validateSchema = process.webpackModule.validateSchema;
const WebpackOptionsValidationError =
process.webpackModule.WebpackOptionsValidationError;

module.exports = function(...args) {
const argv = args[1] || args[0];
Expand Down Expand Up @@ -398,7 +398,7 @@ module.exports = function(...args) {
defineObject = {};
},
function() {
const DefinePlugin = require("webpack").DefinePlugin;
const DefinePlugin = process.webpackModule.DefinePlugin;
addPlugin(options, new DefinePlugin(defineObject));
}
);
Expand Down Expand Up @@ -468,13 +468,13 @@ module.exports = function(...args) {
mapArgToBoolean("cache");

ifBooleanArg("hot", function() {
const HotModuleReplacementPlugin = require("webpack")
.HotModuleReplacementPlugin;
const HotModuleReplacementPlugin =
process.webpackModule.HotModuleReplacementPlugin;
addPlugin(options, new HotModuleReplacementPlugin());
});

ifBooleanArg("debug", function() {
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
addPlugin(
options,
new LoaderOptionsPlugin({
Expand Down Expand Up @@ -510,8 +510,8 @@ module.exports = function(...args) {
});

ifArg("optimize-max-chunks", function(value) {
const LimitChunkCountPlugin = require("webpack").optimize
.LimitChunkCountPlugin;
const LimitChunkCountPlugin =
process.webpackModule.optimize.LimitChunkCountPlugin;
addPlugin(
options,
new LimitChunkCountPlugin({
Expand All @@ -521,7 +521,8 @@ module.exports = function(...args) {
});

ifArg("optimize-min-chunk-size", function(value) {
const MinChunkSizePlugin = require("webpack").optimize.MinChunkSizePlugin;
const MinChunkSizePlugin =
process.webpackModule.optimize.MinChunkSizePlugin;
addPlugin(
options,
new MinChunkSizePlugin({
Expand All @@ -531,7 +532,7 @@ module.exports = function(...args) {
});

ifBooleanArg("optimize-minimize", function() {
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
addPlugin(
options,
new LoaderOptionsPlugin({
Expand All @@ -541,7 +542,7 @@ module.exports = function(...args) {
});

ifArg("prefetch", function(request) {
const PrefetchPlugin = require("webpack").PrefetchPlugin;
const PrefetchPlugin = process.webpackModule.PrefetchPlugin;
addPlugin(options, new PrefetchPlugin(request));
});

Expand All @@ -554,7 +555,7 @@ module.exports = function(...args) {
} else {
name = value;
}
const ProvidePlugin = require("webpack").ProvidePlugin;
const ProvidePlugin = process.webpackModule.ProvidePlugin;
addPlugin(options, new ProvidePlugin(name, value));
});

Expand Down

0 comments on commit 138adfd

Please sign in to comment.