Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

ES2015 Modules #35

Closed
wants to merge 2 commits into from
Closed

ES2015 Modules #35

wants to merge 2 commits into from

Conversation

SpaceK33z
Copy link
Contributor

@SpaceK33z SpaceK33z commented Oct 27, 2016

Since webpack v2, it's better to use ES modules. Note that this is incompatible with webpack v1, so it should be released as a major version.

Fixes #15.

Since webpack v2, it's better to use ES modules. Note that this is incompatible with webpack v1, so it should be released as a major version.
@jhnns
Copy link
Member

jhnns commented Nov 30, 2016

LGTM

`npm install --save json-loader`

For webpack v1 users:

`npm install --save json-loader@0.5.4`
Copy link

@graingert graingert Dec 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will work in webpack 1:

const esModuleLoaderConfig = 'babel-loader?'JSON.stringify({
  babelrc: false,
  plugins: ['transform-es2015-modules-commonjs', 'add-module-exports'],
});

export default {
  loaders: { test: /\.json$/, loader: `{$esModuleLoaderConfig}!json-loader` },
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would in theory work. But it would be much easier to just use 0.5.4.

Copy link
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stop this PR for now, as this is a breakage for all CommonJS users. Even webpack 2.

@michael-ciniawsky michael-ciniawsky changed the title Export an ES Module instead of CommonJS module ES2015 Modules Mar 14, 2017
@joshwiens joshwiens added this to the 1.0.0-beta.0 milestone Apr 9, 2017
@bebraw
Copy link

bebraw commented May 7, 2017

The current code seems to do var module = this.version && this.version >= 2 ? export default ${value};:module.exports = ${value};; so it's likely safe to close this PR.

@michael-ciniawsky
Copy link
Member

Yep save to close 👍 Thx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants