11// @ts -check
2- import { defineConfig } from "@rspack/cli" ;
3- import { rspack } from "@rspack/core" ;
4- import path from "path" ;
5- import { fileURLToPath } from "node:url" ;
6- import { createRequire } from "node:module" ;
2+
3+ import { createRequire } from 'node:module' ;
4+ import path from 'node:path' ;
5+ import { fileURLToPath } from 'node:url' ;
6+ import { defineConfig } from '@rspack/cli' ;
7+ import { rspack } from '@rspack/core' ;
78
89const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
910const require = createRequire ( import . meta. url ) ;
10- const isProduction = process . env . NODE_ENV === " production" ;
11+ const isProduction = process . env . NODE_ENV === ' production' ;
1112
1213export default defineConfig ( {
1314 entry : {
14- main : " ./src/index.jsx" ,
15+ main : ' ./src/index.jsx' ,
1516 } ,
1617 experiments : {
1718 css : true ,
1819 } ,
1920 resolve : {
20- extensions : [ " ..." , " .jsx" ] ,
21+ extensions : [ ' ...' , ' .jsx' ] ,
2122 alias : {
22- "@swc/helpers" : path . dirname (
23- require . resolve ( "@swc/helpers/package.json" )
24- ) ,
23+ '@swc/helpers' : path . dirname ( require . resolve ( '@swc/helpers/package.json' ) ) ,
2524 } ,
2625 } ,
2726 module : {
2827 rules : [
2928 {
3029 test : / \. ( j s x | j s ) $ / ,
3130 use : {
32- loader : " builtin:swc-loader" ,
31+ loader : ' builtin:swc-loader' ,
3332 /**
3433 * @type {import('@rspack/core').SwcLoaderOptions }
3534 */
3635 options : {
3736 jsc : {
3837 parser : {
39- syntax : " ecmascript" ,
38+ syntax : ' ecmascript' ,
4039 jsx : true ,
4140 } ,
4241 transform : {
4342 react : {
44- runtime : " automatic" ,
43+ runtime : ' automatic' ,
4544 development : ! isProduction ,
4645 } ,
4746 } ,
4847 experimental : {
4948 plugins : [
5049 [
51- " @swc/plugin-remove-console" , // need to use specific version to be compatible with rspack's internal swc version
50+ ' @swc/plugin-remove-console' , // need to use specific version to be compatible with rspack's internal swc version
5251 {
53- exclude : [ " error" ] ,
52+ exclude : [ ' error' ] ,
5453 } ,
5554 ] ,
56- [ " @swc/plugin-prefresh" , { } ] ,
57- [ " @swc/plugin-emotion" , { } ] ,
58- [ " @swc/plugin-loadable-components" , { } ] ,
55+ [ ' @swc/plugin-prefresh' , { } ] ,
56+ [ ' @swc/plugin-emotion' , { } ] ,
57+ [ ' @swc/plugin-loadable-components' , { } ] ,
5958 [
60- " @swc/plugin-relay" ,
59+ ' @swc/plugin-relay' ,
6160 {
6261 rootDir : __dirname ,
63- artifactDirectory : " src/__generated__" ,
64- language : " typescript" ,
62+ artifactDirectory : ' src/__generated__' ,
63+ language : ' typescript' ,
6564 } ,
6665 ] ,
67- [ " @swc/plugin-styled-components" , { } ] ,
68- [ " @swc/plugin-styled-jsx" , { } ] ,
69- [ " @swc/plugin-transform-imports" , { } ] ,
66+ [ ' @swc/plugin-styled-components' , { } ] ,
67+ [ ' @swc/plugin-styled-jsx' , { } ] ,
68+ [ ' @swc/plugin-transform-imports' , { } ] ,
7069 // TODO: these plugins are not yet updated to `swc_core` v9
7170 // ['@lingui/swc-plugin', {}],
7271 // ['swc-plugin-css-modules', {}],
@@ -76,17 +75,17 @@ export default defineConfig({
7675 } ,
7776 } ,
7877 } ,
79- type : " javascript/auto" ,
78+ type : ' javascript/auto' ,
8079 } ,
8180 {
8281 test : / \. ( p n g | s v g | j p g ) $ / ,
83- type : " asset/resource" ,
82+ type : ' asset/resource' ,
8483 } ,
8584 ] ,
8685 } ,
8786 plugins : [
8887 new rspack . HtmlRspackPlugin ( {
89- template : " ./index.html" ,
88+ template : ' ./index.html' ,
9089 } ) ,
9190 ] ,
9291} ) ;
0 commit comments