Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ class WebpackCLI {
{
type: 'string',
},
{
type: 'enum',
values: [false],
},
],
negative: true,
alias: 'd',
Expand Down
6 changes: 4 additions & 2 deletions test/build/devtool/array/source-map-array.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ describe('source-map object', () => {

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
// multi compilers
expect(stdout).toContain("devtool: 'source-map'");
expect(stdout).toContain("devtool: 'eval-cheap-module-source-map'");

let files;

Expand All @@ -27,7 +29,7 @@ describe('source-map object', () => {

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(stdout).toContain("devtool: 'source-map'");

let files;

Expand Down
4 changes: 4 additions & 0 deletions test/build/devtool/array/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin');

module.exports = [
{
output: {
Expand All @@ -8,6 +10,7 @@ module.exports = [
entry: './index.js',
mode: 'development',
devtool: 'eval-cheap-module-source-map',
plugins: [new WebpackCLITestPlugin()],
},
{
output: {
Expand All @@ -19,5 +22,6 @@ module.exports = [
mode: 'development',
devtool: 'source-map',
target: 'node',
plugins: [new WebpackCLITestPlugin()],
},
];
19 changes: 16 additions & 3 deletions test/build/devtool/object/source-map-object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('source-map object', () => {

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(stdout).toContain("devtool: 'eval-cheap-module-source-map'");

let files;

Expand All @@ -27,7 +27,7 @@ describe('source-map object', () => {

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(stdout).toContain("devtool: 'source-map'");
expect(existsSync(resolve(__dirname, 'dist/dist-amd.js.map'))).toBeTruthy();
});

Expand All @@ -40,7 +40,20 @@ describe('source-map object', () => {

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(stdout).toContain("devtool: 'source-map'");
expect(existsSync(resolve(__dirname, 'binary/dist-amd.js.map'))).toBeTruthy();
});

it('should override config with devtool false', async () => {
const { exitCode, stderr, stdout } = await run(
__dirname,
['-c', './webpack.eval.config.js', '--no-devtool', '-o', './binary'],
false,
);

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toContain('devtool: false');
expect(existsSync(resolve(__dirname, 'binary/dist-amd.js.map'))).toBeTruthy();
});
});
3 changes: 3 additions & 0 deletions test/build/devtool/object/webpack.eval.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin');

module.exports = {
output: {
filename: './dist-amd.js',
Expand All @@ -7,4 +9,5 @@ module.exports = {
entry: './index.js',
mode: 'development',
devtool: 'eval-cheap-module-source-map',
plugins: [new WebpackCLITestPlugin()],
};
3 changes: 3 additions & 0 deletions test/build/devtool/object/webpack.source.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin');

module.exports = {
output: {
filename: './dist-amd.js',
Expand All @@ -7,4 +9,5 @@ module.exports = {
entry: './index.js',
mode: 'development',
devtool: 'source-map',
plugins: [new WebpackCLITestPlugin()],
};
8 changes: 8 additions & 0 deletions test/help/__snapshots__/help.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Options:
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading multiple configurations.
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
Expand Down Expand Up @@ -130,6 +131,7 @@ Options:
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading multiple configurations.
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
Expand Down Expand Up @@ -183,6 +185,7 @@ Options:
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading multiple configurations.
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
Expand Down Expand Up @@ -240,6 +243,7 @@ Options:
e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading
multiple configurations.
Expand Down Expand Up @@ -418,6 +422,7 @@ Options:
e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading
multiple configurations.
Expand Down Expand Up @@ -500,6 +505,7 @@ Options:
e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading
multiple configurations.
Expand Down Expand Up @@ -542,6 +548,7 @@ Options:
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading multiple configurations.
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
Expand Down Expand Up @@ -595,6 +602,7 @@ Options:
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
-t, --target <value> Sets the build target e.g. node.
-d, --devtool <value> Determine source maps to use.
--no-devtool Do not generate source maps.
--mode <value> Defines the mode to pass to webpack.
--name <value> Name of the configuration. Used when loading multiple configurations.
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
Expand Down