-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack-dev-server): remove output.publicPath from webpack-dev-se…
…rver (#15839) * fix: remove publicPath in react-scripts if it is present * fix: remove publicPath in react-scripts if it is present * fix: remove publicPath in webpack-dev-server regardless * fix: add root path * chore: revert * fix: remove user base path * remove unused function * test: add unit test for make webpack config * chore: make purpose for fake url more clear * do not include local filesystem path in snapshot
- Loading branch information
1 parent
726120d
commit 8e894a0
Showing
5 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
npm/webpack-dev-server/__snapshots__/makeWebpackConfig.spec.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
exports['makeWebpackConfig ignores userland webpack `output.publicPath` 1'] = { | ||
"output": { | ||
"publicPath": "/test-public-path/", | ||
"filename": "[name].js" | ||
}, | ||
"mode": "development", | ||
"optimization": { | ||
"splitChunks": { | ||
"chunks": "all" | ||
} | ||
}, | ||
"plugins": [ | ||
"HtmlWebpackPlugin", | ||
"CypressCTOptionsPlugin", | ||
"LazyCompilePlugin" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
npm/webpack-dev-server/test/unit/makeWebpackConfig.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { expect } from 'chai' | ||
import snapshot from 'snap-shot-it' | ||
import { makeWebpackConfig } from '../../src/makeWebpackConfig' | ||
|
||
describe('makeWebpackConfig', () => { | ||
it('ignores userland webpack `output.publicPath`', async () => { | ||
const actual = await makeWebpackConfig({ | ||
output: { | ||
publicPath: '/this-will-be-ignored', | ||
}, | ||
}, { | ||
devServerPublicPathRoute: '/test-public-path', | ||
isOpenMode: true, | ||
supportFile: '/support.js', | ||
projectRoot: '.', | ||
files: [], | ||
}) | ||
|
||
// plugins contain circular deps which cannot be serialized in a snapshot. | ||
// instead just compare the name and order of the plugins. | ||
// @ts-expect-error | ||
actual.plugins = actual.plugins.map((p) => p.constructor.name) | ||
|
||
// these will include paths from the user's local file system, so we should not include them the snapshot | ||
delete actual.output.path | ||
delete actual.entry | ||
|
||
expect(actual.output.publicPath).to.eq('/test-public-path/') | ||
snapshot(actual) | ||
}) | ||
}) |
8e894a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8e894a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 ia32
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8e894a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8e894a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: