Skip to content

Commit 0b4b20a

Browse files
committed
feat(pack): add swc plugin example
1 parent f3f12b8 commit 0b4b20a

8 files changed

Lines changed: 11237 additions & 11176 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.turbopack
2+
node_modules
3+
dist

examples/with-swc-plugin/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## with-swc-plugin
2+
3+
A example from utoo, using swc plugin to transform the code.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>with-swc-plugin</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script src="./src/index.jsx"></script>
11+
</body>
12+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "with-swc-plugin",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"dev": "up dev",
6+
"build": "up build"
7+
},
8+
"dependencies": {
9+
"react": "^18.2.0",
10+
"react-dom": "^18.2.0"
11+
},
12+
"devDependencies": {
13+
"autoprefixer": "10.4.10",
14+
"@types/react": "^18.2.0",
15+
"@types/react-dom": "^18.2.0",
16+
"swc-plugin-coverage-instrument": "^0.0.32",
17+
"@utoo/pack-cli": "*"
18+
}
19+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom/client";
3+
4+
function App() {
5+
return (
6+
<div className="text-3xl font-bold underline">
7+
Swc Plugin Example by Utoopack.
8+
</div>
9+
);
10+
}
11+
12+
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "../../packages/pack/config_schema.json",
3+
"entry": [
4+
{
5+
"name": "index",
6+
"import": "./src/index.jsx",
7+
"html": {
8+
"template": "./index.html"
9+
}
10+
}
11+
],
12+
"output": {
13+
"clean": true
14+
},
15+
"optimization": {
16+
"minify": false
17+
},
18+
"experimental": {
19+
"swcPlugins": [
20+
[
21+
"swc-plugin-coverage-instrument",
22+
{}
23+
]
24+
]
25+
}
26+
}

0 commit comments

Comments
 (0)