Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

refactor: export as ES2015 Module #10

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
module.exports = function(content) {
this.cacheable && this.cacheable();
this.value = content;
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to the PR but what is this line actually doing 🤔

this.value = content

Copy link

Choose a reason for hiding this comment

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

Good question. It's some webpack 0.9 fix from 9bbe8b2 . I wonder if that line is even needed now.

Choose a reason for hiding this comment

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

Unrelated, but from my debugging session, this assignment does not actually occur, as afterwards, this.value remains undefined. Or, actually, not defined at all.

Copy link

Choose a reason for hiding this comment

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

Another note. this.cacheable is set by default now so it would be possible to drop that.

return "module.exports = " + JSON.stringify(content);
return "export default " + JSON.stringify(content);

Choose a reason for hiding this comment

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

Is this why it isn't working for me with import foo from './foo'?

Choose a reason for hiding this comment

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

I had to do

import * as foo from './foo'

which is very wrong... If this will correct behavior, please accept...

Confirmed working with webpack v2.2.1.

}