Skip to content

Commit 0350e5d

Browse files
committed
feat: support .cjs, .mjs, and their JSX friends
1 parent edb003a commit 0350e5d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/index.cjs

+16-1
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,24 @@ class ScratchWebpackConfigBuilder {
6262
type: 'umd2'
6363
}
6464
},
65+
resolve: {
66+
extensions: [
67+
'.mjs',
68+
'.cjs',
69+
...(
70+
enableReact ? [
71+
'.mjsx',
72+
'.cjsx',
73+
'.jsx'
74+
] : []
75+
),
76+
// defaults ('.js', '.json', etc.)
77+
'...'],
78+
modules: [this._srcPath, 'node_modules']
79+
},
6580
module: {
6681
rules: [{
67-
test: enableReact ? /\.jsx?$/ : /\.js$/,
82+
test: enableReact ? /\.[cm]?jsx?$/ : /\.[cm]?js$/,
6883
loader: 'babel-loader',
6984
options: {
7085
presets: [

0 commit comments

Comments
 (0)