Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

RFC - Dealing with imports/exports #23

@bebraw

Description

@bebraw

Context: webpack-contrib/file-loader#130 (comment)

If webpack packages use import/export semantics and don't transpile, we'll end up with issues like this:

file-loader [feat-webpack-defaults] $ npm run build

> [email protected] prebuild .../file-loader
> yarn run clean:dist

yarn run v0.20.3
$ del-cli dist
✨  Done in 0.50s.

> [email protected] build .../file-loader
> cross-env NODE_ENV=production babel -s true src -d dist --ignore 'src/**/*.test.js'

src/index.js -> dist/index.js
file-loader [feat-webpack-defaults] $ node
> require('./')
.../file-loader/dist/index.js:5
import loaderUtils from 'loader-utils';
^^^^^^
SyntaxError: Unexpected token import

The problem is that if we do export default something, then that will lead to the .default issue with CommonJS environments.

Any ideas on a clean way to handle this? Maybe packages should use ES6 style internally and expose their public API through a CommonJS module.exports?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions