Skip to content

Commit

Permalink
bug #439 updating resolve.extensions to include webpack4 default exte…
Browse files Browse the repository at this point in the history
…nsions (weaverryan)

This PR was merged into the master branch.

Discussion
----------

updating resolve.extensions to include webpack4 default extensions

Fixes #430

Commits
-------

67d7ab1 updating resolve.extensions to include webpack4 default extensions
  • Loading branch information
weaverryan committed Nov 16, 2018
2 parents bbf687b + 67d7ab1 commit 4a64ceb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions fixtures/js/hello_world.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
document.getElementById('app').innerHTML = 'Hello World!';
2 changes: 1 addition & 1 deletion lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ConfigGenerator {
config.stats = this.buildStatsConfig();

config.resolve = {
extensions: ['.js', '.jsx', '.vue', '.ts', '.tsx'],
extensions: ['.wasm', '.mjs', '.js', '.json', '.jsx', '.vue', '.ts', '.tsx'],
alias: Object.assign({}, this.webpackConfig.aliases)
};

Expand Down
16 changes: 16 additions & 0 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,22 @@ module.exports = {
done();
});
});

it('.mjs files are supported natively', (done) => {
const config = createWebpackConfig('web/build', 'dev');
config.addEntry('main', './js/hello_world');
config.setPublicPath('/build');

testSetup.runWebpack(config, (webpackAssert) => {
// check that main.js has the correct contents
webpackAssert.assertOutputFileContains(
'main.js',
'Hello World!'
);

done();
});
});
});
});
});

0 comments on commit 4a64ceb

Please sign in to comment.