Skip to content

Discourage mixing CJS and ES6 module syntax in docs #552

Closed
@wyuenho

Description

@wyuenho

Moved from webpack/webpack#3571

Experience has shown that it is easy to fall into a trap like this:

// a.js
import 'whatever';
module.exports = function foo () {};

// b.js
import a from './a.js'; // error, no default member found in a
a.foo();

Much code has been written like this and it used to work in Webpack 2 beta, which only exacerbates the problem of spec-incompliant code like above. Webpack's doc seems to advertise the ability to mix and match different module syntax without mentioning gotchas. I suggest that Webpack should actively discourage this practice when possible, and point people to tools such as eslint-plugin-import to help fix their code.

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