Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack Compiling Error afte update 5.5.0 #8982

Closed
andrei22b opened this issue Oct 27, 2020 · 4 comments
Closed

Webpack Compiling Error afte update 5.5.0 #8982

andrei22b opened this issue Oct 27, 2020 · 4 comments

Comments

@andrei22b
Copy link

andrei22b commented Oct 27, 2020

Current behavior

When trying to open Cypress 5.5.0 after updating i get the error: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/***/***/tests/e2e/webpack.config.js

Full Error

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/-/-/tests/e2e/webpack.config.js
require() of ES modules is not supported.
require() of /Users/-/-/tests/e2e/webpack.config.js from /Users/-/-/tests/e2e/utils/index.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename webpack.config.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/-/-/tests/e2e/package.json.

    at Module._extensions..js (internal/modules/cjs/loader.js:1162:13)
    at Object.require.extensions.<computed> [as .js] (/Users/-/Library/Caches/Cypress/5.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-node/src/index.ts:539:12)
    at Module.load (internal/modules/cjs/loader.js:981:32)
    at Module._load (internal/modules/cjs/loader.js:881:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:1023:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/-/-/tests/e2e/utils/index.ts:5:1)
    at Module._compile (internal/modules/cjs/loader.js:1145:30)
    at Module.m._compile (/Users/-/Library/Caches/Cypress/5.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-node/src/index.ts:536:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1166:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/-/Library/Caches/Cypress/5.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-node/src/index.ts:539:12)
    at Module.load (internal/modules/cjs/loader.js:981:32)
    at Module._load (internal/modules/cjs/loader.js:881:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:1023:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at runPlugins (/Users/-/Library/Caches/Cypress/5.5.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:213:15)
    at Object.<anonymous> (/Users/-/Library/Caches/Cypress/5.5.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/index.js:8:25)
    at Module._compile (internal/modules/cjs/loader.js:1145:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:10)
    at Module.load (internal/modules/cjs/loader.js:981:32)

Versions

5.5.0

Webpack config

const path = require('path');

module.exports = {
    stats: 'detailed',
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
        ]
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js']
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    node: {
        fs: 'empty',
        net: 'empty',
        tls: 'empty'
    }
};
@jennifer-shehane
Copy link
Member

Could you clarify what Cypress version you were updating from? What was the last working version?

Looks like this could be #8090

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Oct 28, 2020
@andrei22b
Copy link
Author

Last version was 5.3.0

@davidtorge12
Copy link

davidtorge12 commented Oct 28, 2020

Same problem here,
the error appeared starting with version 5.4. I thought that it will be fixed in 5.5 but it seems that it persists
Please fix it!

@andrei22b
Copy link
Author

Fixed with renaming webpack.config.js to webpack.config.cjs

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants