Skip to content

Commit 713c5a6

Browse files
authored
refactor: use 'public' directory as default value for 'static' (#3005)
BRAKING CHANGE: default `static` value is `public`
1 parent ebcdd98 commit 713c5a6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/utils/normalizeOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function normalizeOptions(compiler, options) {
1515
: {};
1616

1717
const defaultOptionsForStatic = {
18-
directory: path.join(process.cwd(), 'static'),
18+
directory: path.join(process.cwd(), 'public'),
1919
staticOptions: {},
2020
publicPath: ['/'],
2121
serveIndex: { icons: true },

test/cli/__snapshots__/cli.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`CLI --hot webpack 5 1`] = `
44
"<i> [webpack-dev-server] Project is running at http://localhost:8080/
5-
<i> [webpack-dev-server] Content not from webpack x.x.x served from 'Xdir/static' directory
5+
<i> [webpack-dev-server] Content not from webpack x.x.x served from 'Xdir/public' directory
66
<i> [webpack-dev-middleware] asset main.js X KiB [emitted] (name: main)
77
<i> runtime modules X KiB 10 modules
88
<i> cacheable modules X KiB
@@ -21,7 +21,7 @@ exports[`CLI --hot webpack 5 1`] = `
2121
2222
exports[`CLI --no-hot webpack 5 1`] = `
2323
"<i> [webpack-dev-server] Project is running at http://localhost:8080/
24-
<i> [webpack-dev-server] Content not from webpack x.x.x served from 'Xdir/static' directory
24+
<i> [webpack-dev-server] Content not from webpack x.x.x served from 'Xdir/public' directory
2525
<i> [webpack-dev-middleware] asset main.js X KiB [emitted] (name: main)
2626
<i> runtime modules X bytes 3 modules
2727
<i> cacheable modules X KiB

test/server/utils/normalizeOptions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ describe('normalizeOptions', () => {
449449

450450
if (data.options.static) {
451451
data.options.static.forEach((staticOpts) => {
452-
if (staticOpts.directory === path.join(process.cwd(), 'static')) {
452+
if (staticOpts.directory === path.join(process.cwd(), 'public')) {
453453
// give an indication in the snapshot that this is the
454454
// current working directory
455455
staticOpts.directory = 'CWD';

0 commit comments

Comments
 (0)