Skip to content

Commit

Permalink
fix: revert dynamic import of webpack config file (#24598)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJW34 committed Nov 8, 2022
1 parent 5e3a21c commit 69f7dab
Show file tree
Hide file tree
Showing 13 changed files with 2,233 additions and 8 deletions.
1 change: 1 addition & 0 deletions npm/webpack-dev-server/package.json
Expand Up @@ -21,6 +21,7 @@
"fs-extra": "9.1.0",
"html-webpack-plugin-4": "npm:html-webpack-plugin@^4",
"html-webpack-plugin-5": "npm:html-webpack-plugin@^5",
"local-pkg": "0.4.1",
"speed-measure-webpack-plugin": "1.4.2",
"tslib": "^2.3.1",
"webpack-dev-server": "^4.7.4",
Expand Down
5 changes: 3 additions & 2 deletions npm/webpack-dev-server/src/makeWebpackConfig.ts
@@ -1,11 +1,12 @@
import { debug as debugFn } from 'debug'
import * as path from 'path'
import { merge } from 'webpack-merge'
import { importModule } from 'local-pkg'
import type { Configuration, EntryObject } from 'webpack'
import { makeCypressWebpackConfig } from './makeDefaultWebpackConfig'
import type { CreateFinalWebpackConfig } from './createWebpackDevServer'
import { configFiles } from './constants'
import { dynamicAbsoluteImport, dynamicImport } from './dynamic-import'
import { dynamicImport } from './dynamic-import'

const debug = debugFn('cypress:webpack-dev-server:makeWebpackConfig')

Expand Down Expand Up @@ -90,7 +91,7 @@ export async function makeWebpackConfig (

if (configFile) {
debug('found webpack config %s', configFile)
const sourcedConfig = await dynamicAbsoluteImport(configFile)
const sourcedConfig = await importModule(configFile)

debug('config contains %o', sourcedConfig)
if (sourcedConfig && typeof sourcedConfig === 'object') {
Expand Down
10 changes: 10 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/cypress.config.ts
@@ -0,0 +1,10 @@
import { defineConfig } from 'cypress'

export default defineConfig({
component: {
devServer: {
bundler: 'webpack',
} as any,
supportFile: false,
},
})
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
3 changes: 3 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/helloWorld.ts
@@ -0,0 +1,3 @@
export const helloWorld = () => {
return 'Hello World'
}
19 changes: 19 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/package.json
@@ -0,0 +1,19 @@
{
"name": "ct-webpack-ts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"html-webpack-plugin": "^5.5.0",
"ts-loader": "^9.4.1",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-dev-server": "^4.11.1"
},
"license": "ISC",
"author": "",
"keywords": []
}
5 changes: 5 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/test.cy.ts
@@ -0,0 +1,5 @@
import { helloWorld } from './helloWorld'

it('should return "Hello World"', () => {
expect(helloWorld()).eq('Hello World')
})
7 changes: 7 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/tsconfig.json
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node"
},
"include": ["**/*.ts"]
}
24 changes: 24 additions & 0 deletions system-tests/projects/webpack-dev-server-ts/webpack.config.ts
@@ -0,0 +1,24 @@
export default {
mode: 'development',
devtool: 'inline-source-map',
entry: './app.ts',
output: {
filename: 'bundle.js',
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: ['.ts', '.tsx', '.js'],
// Add support for TypeScripts fully qualified ESM imports.
extensionAlias: {
'.js': ['.js', '.ts'],
'.cjs': ['.cjs', '.cts'],
'.mjs': ['.mjs', '.mts'],
},
},
module: {
rules: [
// all files with a `.ts`, `.cts`, `.mts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.([cm]?ts|tsx)$/, loader: 'ts-loader' },
],
},
}

5 comments on commit 69f7dab

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 69f7dab Nov 8, 2022

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:

npm install https://cdn.cypress.io/beta/npm/11.0.0/linux-x64/develop-69f7dabc94a5adb25edc7fda6057e92b8bd2e072/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 69f7dab Nov 8, 2022

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 arm64 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:

npm install https://cdn.cypress.io/beta/npm/11.0.0/linux-arm64/develop-69f7dabc94a5adb25edc7fda6057e92b8bd2e072/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 69f7dab Nov 8, 2022

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 arm64 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:

npm install https://cdn.cypress.io/beta/npm/11.0.0/darwin-arm64/develop-69f7dabc94a5adb25edc7fda6057e92b8bd2e072/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 69f7dab Nov 8, 2022

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:

npm install https://cdn.cypress.io/beta/npm/11.0.0/darwin-x64/develop-69f7dabc94a5adb25edc7fda6057e92b8bd2e072/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 69f7dab Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle 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:

npm install https://cdn.cypress.io/beta/npm/11.0.0/win32-x64/develop-69f7dabc94a5adb25edc7fda6057e92b8bd2e072/cypress.tgz

Please sign in to comment.