Skip to content

Commit 4a64ceb

Browse files
committed
bug #439 updating resolve.extensions to include webpack4 default extensions (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
2 parents bbf687b + 67d7ab1 commit 4a64ceb

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

fixtures/js/hello_world.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
document.getElementById('app').innerHTML = 'Hello World!';

lib/config-generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ConfigGenerator {
9292
config.stats = this.buildStatsConfig();
9393

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

test/functional.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,22 @@ module.exports = {
17431743
done();
17441744
});
17451745
});
1746+
1747+
it('.mjs files are supported natively', (done) => {
1748+
const config = createWebpackConfig('web/build', 'dev');
1749+
config.addEntry('main', './js/hello_world');
1750+
config.setPublicPath('/build');
1751+
1752+
testSetup.runWebpack(config, (webpackAssert) => {
1753+
// check that main.js has the correct contents
1754+
webpackAssert.assertOutputFileContains(
1755+
'main.js',
1756+
'Hello World!'
1757+
);
1758+
1759+
done();
1760+
});
1761+
});
17461762
});
17471763
});
17481764
});

0 commit comments

Comments
 (0)