Skip to content

Expose resolved webpack config for external tool #4286

@amoshydra

Description

@amoshydra

What problem does this feature solve?

I am trying to add unit test with ava in this project. However, webpack alias is not understood by ava. This problem with ava could be resolved by providing a webpack config.

As of now, we need to create the webpack config by hand and try to match it with what nuxt is using.

If a resolved webpack config is produced and exposed, we could use this config with our testing, linting and other external tools.

Related to:

What does the proposed changes look like?

Perhaps, it could look something similar to vue's cli-service implementation. Where the resolved webpack.config is exposed as a file.

https://cli.vuejs.org/guide/webpack.html#inspecting-the-project-s-webpack-config

For testing use case, perhaps:

  1. Developer call a function provided by nuxt to trigger the resolvation of webpack.config
  2. Nuxt expose the resolved webpack.config as a file
  3. Developer run test script which rely on the exposed webpack.config

For linting use case,

  1. Perhaps a base webpack.config can always be exposed as a file at the begining
  2. When developer call nuxt dev, a new resolved webpack.config can override the existing webpack.config
  3. IDE / Editor's eslint tool could automatically pick up this change and update its rule accordingly?

In summary,

  1. Expose a base webpack.config
  2. Resolve and update webpack.config as nuxt is building or via a function call by developer
  3. Developer / external tool make use of this resolved config
This feature request is available on Nuxt community (#c8098)

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