Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

[feature/bug fix] Support for ES6 modules transpiled by babel >= 6 #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kkwiatkowski
Copy link

@kkwiatkowski kkwiatkowski commented May 8, 2016

Motivation

When you use Babel 6 to transpile code, the exports varies a bit from regular CommonJS exports.
And because of that loaders written in ES6, transpiled by Babel 6 are not handled correctly in Webpack.

> webpack

Hash: 203cfe0179c71fd5b113
Version: webpack 1.13.0
Time: 903ms
        Asset     Size  Chunks             Chunk Names
./bin/main.js  1.95 kB       0  [emitted]  main
    + 3 hidden modules

ERROR in Loader c:\www\dll-prototype\dll-linker-example\node_modules\dll\lib\linker?dll-wrapper-example didn't return a function
 @ ./src/main.js 3:25-55

This is also related with: #webpack/issues/2047

Pull request

I don't know if this is proper place for that, but I hope it's fine.
Would be great, if it's treated as patch, if merged.

@kkwiatkowski
Copy link
Author

Any feedback about this pull request, @sokra?

@kkwiatkowski
Copy link
Author

kkwiatkowski commented May 31, 2016

Is there any chance to not let it die, @sokra?

@sokra
Copy link
Member

sokra commented May 31, 2016

Sorry, webpack/core is no longer used by webpack.

webpack 2 now uses https://github.com/webpack/loader-runner

and it supports loaders exporting ES6 https://github.com/webpack/loader-runner/blob/master/lib/loadLoader.js#L31

I'm willing to merge your changes, but they need to be compatible with the webpack 2 format:

export default function(source) { return source; /* normal */ }
export function pitch(...) { /* pitch */ }

Your PR doesn't implement the pitch part correctly.

You could move the default read before this line: https://github.com/webpack/core/blob/master/lib/NormalModuleMixin.js#L290

@kkwiatkowski
Copy link
Author

Ok, I'll do that. Thanks for answer 👍

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.

2 participants