@@ -60,6 +60,7 @@ const EXCLUDE_TRANSPILATION_PATTERNS = [
6060 / n o d e _ m o d u l e s \/ r e a c t \/ / ,
6161 / n o d e _ m o d u l e s \/ c o r e - j s \/ / ,
6262] ;
63+
6364const JS_EXT_PATTERN = / \. j s x ? $ / ;
6465
6566/*::
@@ -99,6 +100,8 @@ function getWebpackConfig(opts /*: WebpackConfigOpts */) {
99100 const { id, dev, dir, watch, state, fusionConfig, legacyPkgConfig = { } } = opts ;
100101 const main = 'src/main.js' ;
101102
103+ const jsExtPattern = fusionConfig . jsExtPattern || JS_EXT_PATTERN ;
104+
102105 if ( ! fs . existsSync ( path . join ( dir , main ) ) ) {
103106 throw new Error ( `Project directory must contain a ${ main } file` ) ;
104107 }
@@ -269,7 +272,7 @@ function getWebpackConfig(opts /*: WebpackConfigOpts */) {
269272 */
270273 runtime === 'server' && {
271274 compiler : id => id === 'server' ,
272- test : JS_EXT_PATTERN ,
275+ test : jsExtPattern ,
273276 exclude : EXCLUDE_TRANSPILATION_PATTERNS ,
274277 use : [
275278 {
@@ -299,7 +302,7 @@ function getWebpackConfig(opts /*: WebpackConfigOpts */) {
299302 */
300303 ( runtime === 'client' || runtime === 'sw' ) && {
301304 compiler : id => id === 'client' || id === 'sw' ,
302- test : JS_EXT_PATTERN ,
305+ test : jsExtPattern ,
303306 exclude : EXCLUDE_TRANSPILATION_PATTERNS ,
304307 use : [
305308 {
@@ -329,7 +332,7 @@ function getWebpackConfig(opts /*: WebpackConfigOpts */) {
329332 */
330333 runtime === 'client' && {
331334 compiler : id => id === 'client-legacy' ,
332- test : JS_EXT_PATTERN ,
335+ test : jsExtPattern ,
333336 exclude : EXCLUDE_TRANSPILATION_PATTERNS ,
334337 use : [
335338 {
0 commit comments