File tree Expand file tree Collapse file tree 5 files changed +39
-40
lines changed
Expand file tree Collapse file tree 5 files changed +39
-40
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @callstack/repack " : minor
3+ ---
4+
5+ Update new project templates for Re.Pack 5.2
Original file line number Diff line number Diff line change @@ -7,17 +7,25 @@ const Repack = require('@callstack/repack');
77 * Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
88 */
99
10- module . exports = {
10+ module . exports = Repack . defineRspackConfig ( {
1111 context : __dirname ,
1212 entry : './index.js' ,
1313 resolve : {
1414 ...Repack . getResolveOptions ( ) ,
1515 } ,
1616 module : {
1717 rules : [
18- ...Repack . getJsTransformRules ( ) ,
18+ {
19+ test : / \. [ c m ] ? [ j t ] s x ? $ / ,
20+ type : 'javascript/auto' ,
21+ use : {
22+ loader : '@callstack/repack/babel-swc-loader' ,
23+ parallel : true ,
24+ options : { } ,
25+ } ,
26+ } ,
1927 ...Repack . getAssetTransformRules ( ) ,
2028 ] ,
2129 } ,
2230 plugins : [ new Repack . RepackPlugin ( ) ] ,
23- } ;
31+ } ) ;
Original file line number Diff line number Diff line change @@ -12,17 +12,25 @@ const __dirname = path.dirname(__filename);
1212 * Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
1313 */
1414
15- export default {
15+ export default Repack . defineRspackConfig ( {
1616 context : __dirname ,
1717 entry : './index.js' ,
1818 resolve : {
1919 ...Repack . getResolveOptions ( ) ,
2020 } ,
2121 module : {
2222 rules : [
23- ...Repack . getJsTransformRules ( ) ,
23+ {
24+ test : / \. [ c m ] ? [ j t ] s x ? $ / ,
25+ type : 'javascript/auto' ,
26+ use : {
27+ loader : '@callstack/repack/babel-swc-loader' ,
28+ parallel : true ,
29+ options : { } ,
30+ } ,
31+ } ,
2432 ...Repack . getAssetTransformRules ( ) ,
2533 ] ,
2634 } ,
2735 plugins : [ new Repack . RepackPlugin ( ) ] ,
28- } ;
36+ } ) ;
Original file line number Diff line number Diff line change 11const Repack = require ( '@callstack/repack' ) ;
2- const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
32
43/**
54 * Webpack configuration enhanced with Re.Pack defaults for React Native.
@@ -8,7 +7,7 @@ const TerserPlugin = require('terser-webpack-plugin');
87 * Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
98 */
109
11- module . exports = {
10+ module . exports = Repack . defineWebpackConfig ( {
1211 context : __dirname ,
1312 entry : './index.js' ,
1413 resolve : {
@@ -18,24 +17,14 @@ module.exports = {
1817 rules : [
1918 {
2019 test : / \. [ c m ] ? [ j t ] s x ? $ / ,
21- use : 'babel-loader' ,
2220 type : 'javascript/auto' ,
21+ use : {
22+ loader : '@callstack/repack/babel-swc-loader' ,
23+ options : { } ,
24+ } ,
2325 } ,
2426 ...Repack . getAssetTransformRules ( ) ,
2527 ] ,
2628 } ,
27- optimization : {
28- minimizer : [
29- new TerserPlugin ( {
30- test : / \. ( j s ) ? b u n d l e ( \? .* ) ? $ / i,
31- extractComments : false ,
32- terserOptions : {
33- format : {
34- comments : false ,
35- } ,
36- } ,
37- } ) ,
38- ] ,
39- } ,
4029 plugins : [ new Repack . RepackPlugin ( ) ] ,
41- } ;
30+ } ) ;
Original file line number Diff line number Diff line change 11import path from 'node:path' ;
22import { fileURLToPath } from 'node:url' ;
33import * as Repack from '@callstack/repack' ;
4- import TerserPlugin from 'terser-webpack-plugin' ;
54
65const __filename = fileURLToPath ( import . meta. url ) ;
76const __dirname = path . dirname ( __filename ) ;
@@ -13,7 +12,7 @@ const __dirname = path.dirname(__filename);
1312 * Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
1413 */
1514
16- export default {
15+ export default Repack . defineWebpackConfig ( {
1716 context : __dirname ,
1817 entry : './index.js' ,
1918 resolve : {
@@ -23,24 +22,14 @@ export default {
2322 rules : [
2423 {
2524 test : / \. [ c m ] ? [ j t ] s x ? $ / ,
26- use : 'babel-loader' ,
2725 type : 'javascript/auto' ,
26+ use : {
27+ loader : '@callstack/repack/babel-swc-loader' ,
28+ options : { } ,
29+ } ,
2830 } ,
2931 ...Repack . getAssetTransformRules ( ) ,
3032 ] ,
3133 } ,
32- optimization : {
33- minimizer : [
34- new TerserPlugin ( {
35- test : / \. ( j s ) ? b u n d l e ( \? .* ) ? $ / i,
36- extractComments : false ,
37- terserOptions : {
38- format : {
39- comments : false ,
40- } ,
41- } ,
42- } ) ,
43- ] ,
44- } ,
4534 plugins : [ new Repack . RepackPlugin ( ) ] ,
46- } ;
35+ } ) ;
You can’t perform that action at this time.
0 commit comments