feat: support .cjs, .mjs, and their JSX friends

This commit is contained in:
Christopher Willis-Ford 2024-03-11 13:54:44 -07:00
parent edb003a62e
commit 0350e5ddef

View file

@ -62,9 +62,24 @@ class ScratchWebpackConfigBuilder {
type: 'umd2'
}
},
resolve: {
extensions: [
'.mjs',
'.cjs',
...(
enableReact ? [
'.mjsx',
'.cjsx',
'.jsx'
] : []
),
// defaults ('.js', '.json', etc.)
'...'],
modules: [this._srcPath, 'node_modules']
},
module: {
rules: [{
test: enableReact ? /\.jsx?$/ : /\.js$/,
test: enableReact ? /\.[cm]?jsx?$/ : /\.[cm]?js$/,
loader: 'babel-loader',
options: {
presets: [