Skip to content

Webpack configuration: vue-cli should load .node files by default #3937

Open
@andrei-pmbcn

Description

@andrei-pmbcn

What problem does this feature solve?

Currently, jsdom cannot run in vue-cli projects that use unit tests without changing the projects' webpack configurations. However, jsdom is essential for testing apps developed for browsers, as it allows people to mock the window object and other features of browsers, without which most of the vue components' methods would throw errors. It would therefore be worthwhile to integrate node-loader by default in the webpack configurations of projects that use unit testing, so that jsdom can be loaded into their tests.

What does the proposed API look like?

The equivalent of this webpack-chain statement:
chainWebpack: config => {
config.module
.rule('node')
.test(/.node$/)
.use('node-loader')
.loader('node-loader')
.end()
}

EDIT: changed this to a feature request when I noticed that the problem can be solved by adding a feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions