Skip to content

Commit 5b0cb08

Browse files
committed
update example
1 parent ecb785e commit 5b0cb08

4 files changed

Lines changed: 44 additions & 50 deletions

File tree

rspack/inline-const-enum/rspack.config.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,42 @@
33
/** @type {import("@rspack/core").Configuration} */
44
export default {
55
entry: {
6-
main: "./src/index.ts",
6+
main: './src/index.ts',
77
},
8-
experiments: {
9-
inlineEnum: true,
10-
},
11-
mode: "production",
8+
mode: 'production',
129
optimization: {
10+
// This is the feature that enables inlining, it's enabled by default in production mode
11+
inlineExports: true,
1312
// disable minimize so you can understand the output
1413
minimize: false,
1514
},
1615
resolve: {
17-
extensions: [".ts", "..."],
16+
extensions: ['.ts', '...'],
1817
},
1918
module: {
2019
rules: [
2120
{
2221
test: /\.ts$/,
2322
use: {
24-
loader: "builtin:swc-loader",
23+
loader: 'builtin:swc-loader',
2524
/** @type {import("@rspack/core").SwcLoaderOptions} */
2625
options: {
2726
jsc: {
2827
parser: {
29-
syntax: "typescript",
28+
syntax: 'typescript',
3029
},
3130
transform: {
3231
tsEnumIsMutable: true,
33-
}
32+
},
3433
},
3534
rspackExperiments: {
3635
collectTypeScriptInfo: {
3736
exportedEnum: 'const-only',
38-
}
39-
}
37+
},
38+
},
4039
},
4140
},
42-
type: "javascript/auto",
41+
type: 'javascript/auto',
4342
},
4443
],
4544
},

rspack/inline-const/rspack.config.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
// @ts-check
2-
import { rspack } from "@rspack/core";
2+
import { rspack } from '@rspack/core';
33

44
/** @type {import("@rspack/core").Configuration} */
55
export default {
66
entry: {
7-
main: "./src/index.ts",
7+
main: './src/index.ts',
88
},
9-
experiments: {
10-
inlineConst: true,
11-
},
12-
mode: "production",
9+
mode: 'production',
1310
optimization: {
11+
// This is the feature that enables inlining, it's enabled by default in production mode
12+
inlineExports: true,
1413
// disable minimize so you can understand the output
1514
minimize: false,
1615
},
1716
resolve: {
18-
extensions: [".ts", "..."],
17+
extensions: ['.ts', '...'],
1918
},
2019
plugins: [
2120
new rspack.DefinePlugin({
22-
ENV: JSON.stringify("mobile"),
21+
ENV: JSON.stringify('mobile'),
2322
}),
2423
],
2524
module: {
2625
rules: [
2726
{
2827
test: /\.ts$/,
2928
use: {
30-
loader: "builtin:swc-loader",
29+
loader: 'builtin:swc-loader',
3130
/** @type {import("@rspack/core").SwcLoaderOptions} */
3231
options: {
3332
jsc: {
3433
parser: {
35-
syntax: "typescript",
34+
syntax: 'typescript',
3635
},
37-
target: "es2015", // use target es2015 or greater so swc won't transform const to var
36+
target: 'es2015', // use target es2015 or greater so swc won't transform const to var
3837
},
3938
},
4039
},
41-
type: "javascript/auto",
40+
type: 'javascript/auto',
4241
},
4342
],
4443
},

rspack/inline-enum/rspack.config.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,39 @@
33
/** @type {import("@rspack/core").Configuration} */
44
export default {
55
entry: {
6-
main: "./src/index.ts",
6+
main: './src/index.ts',
77
},
8-
experiments: {
9-
inlineEnum: true,
10-
},
11-
mode: "production",
8+
mode: 'production',
129
optimization: {
10+
// This is the feature that enables inlining, it's enabled by default in production mode
11+
inlineExports: true,
1312
// disable minimize so you can understand the output
1413
minimize: false,
1514
},
1615
resolve: {
17-
extensions: [".ts", "..."],
16+
extensions: ['.ts', '...'],
1817
},
1918
module: {
2019
rules: [
2120
{
2221
test: /\.ts$/,
2322
use: {
24-
loader: "builtin:swc-loader",
23+
loader: 'builtin:swc-loader',
2524
/** @type {import("@rspack/core").SwcLoaderOptions} */
2625
options: {
2726
jsc: {
2827
parser: {
29-
syntax: "typescript",
30-
}
28+
syntax: 'typescript',
29+
},
3130
},
3231
rspackExperiments: {
3332
collectTypeScriptInfo: {
3433
exportedEnum: true,
35-
}
36-
}
34+
},
35+
},
3736
},
3837
},
39-
type: "javascript/auto",
38+
type: 'javascript/auto',
4039
},
4140
],
4241
},

rspack/type-reexports-presence/rspack.config.mjs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,42 @@
33
/** @type {import("@rspack/core").Configuration} */
44
export default {
55
entry: {
6-
main: "./src/index.ts",
6+
main: './src/index.ts',
77
},
8-
experiments: {
9-
typeReexportsPresence: true,
10-
},
11-
mode: "production",
8+
mode: 'production',
129
optimization: {
1310
// disable minimize so you can understand the output
1411
minimize: false,
1512
},
1613
resolve: {
17-
extensions: [".ts", "..."],
14+
extensions: ['.ts', '...'],
1815
},
1916
module: {
2017
parser: {
2118
javascript: {
22-
typeReexportsPresence: "tolerant",
23-
}
19+
typeReexportsPresence: 'tolerant',
20+
},
2421
},
2522
rules: [
2623
{
2724
test: /\.ts$/,
2825
use: {
29-
loader: "builtin:swc-loader",
26+
loader: 'builtin:swc-loader',
3027
/** @type {import("@rspack/core").SwcLoaderOptions} */
3128
options: {
3229
jsc: {
3330
parser: {
34-
syntax: "typescript",
35-
}
31+
syntax: 'typescript',
32+
},
3633
},
3734
rspackExperiments: {
3835
collectTypeScriptInfo: {
3936
typeExports: true,
40-
}
41-
}
37+
},
38+
},
4239
},
4340
},
44-
type: "javascript/auto",
41+
type: 'javascript/auto',
4542
},
4643
],
4744
},

0 commit comments

Comments
 (0)