Skip to content

Commit 5c0391d

Browse files
authored
ESM build (#12)
1 parent 263d61d commit 5c0391d

File tree

15 files changed

+1989
-4030
lines changed

15 files changed

+1989
-4030
lines changed

.npmignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

context.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

example/node/plain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const handler = async (
1010
if (context.path === "/plain") {
1111
const api = makeApi<ApiData, KoaContext>({
1212
actions,
13-
context
13+
context,
1414
});
1515
context.body = (await api("say.hi", { who: "plain-node" })).hi;
1616
} else {

example/package-lock.json

Lines changed: 1231 additions & 3893 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@
1414
},
1515
"license": "MIT",
1616
"dependencies": {
17-
"@webcarrot/api": "^1.8.1",
17+
"@webcarrot/api": "file:../webcarrot-api-1.8.1.tgz",
1818
"co-body": "^6.1.0",
1919
"koa": "^2.13.4",
20-
"react": "^18.1.0",
21-
"react-dom": "^18.1.0"
20+
"react": "^18.2.0",
21+
"react-dom": "^18.2.0"
2222
},
2323
"devDependencies": {
2424
"@types/co-body": "6.1.0",
25-
"@types/koa": "^2.13.4",
26-
"@types/react": "^18.0.9",
27-
"@types/react-dom": "^18.0.5",
28-
"awesome-typescript-loader": "^5.2.1",
29-
"typescript": "^4.7.2",
30-
"webpack": "^5.72.1",
31-
"webpack-cli": "^4.9.2"
25+
"@types/koa": "^2.13.5",
26+
"@types/react": "^18.0.21",
27+
"@types/react-dom": "^18.0.6",
28+
"ts-loader": "^9.4.1",
29+
"tsconfig-paths-webpack-plugin": "^4.0.0",
30+
"typescript": "^4.8.4",
31+
"webpack": "^5.74.0",
32+
"webpack-cli": "^4.10.0"
3233
}
3334
}

example/webpack.config.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,45 @@
11
const { join } = require("path");
2-
3-
const { TsConfigPathsPlugin } = require("awesome-typescript-loader");
2+
const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin");
43
const { DefinePlugin } = require("webpack");
54

65
module.exports = {
76
entry: join(__dirname, "./browser/react.ts"),
87
output: {
98
path: join(__dirname, "./build"),
109
filename: "./build/react.js",
11-
publicPath: "/build"
10+
publicPath: "/build",
1211
},
1312
watch: false,
1413
mode: "production",
1514
devtool: "inline-source-map",
1615
externals: {
1716
react: "React",
18-
"react-dom": "ReactDOM"
17+
"react-dom": "ReactDOM",
1918
},
2019
resolve: {
2120
extensions: [".ts", ".tsx", ".js"],
2221
plugins: [
23-
new TsConfigPathsPlugin({
24-
tsconfig: join(__dirname + "./tsconfig.webpack.json"),
25-
compiler: "typescript"
26-
})
27-
]
22+
new TsconfigPathsPlugin({
23+
configFile: join(__dirname, "./tsconfig.webpack.json"),
24+
}),
25+
],
2826
},
2927
plugins: [
3028
new DefinePlugin({
3129
NODE_ENV: JSON.stringify("production"),
32-
"process.env.NODE_ENV": JSON.stringify("production")
33-
})
30+
"process.env.NODE_ENV": JSON.stringify("production"),
31+
}),
3432
],
3533
module: {
3634
rules: [
3735
{
3836
test: /\.tsx?$/,
39-
loader: "awesome-typescript-loader"
40-
}
41-
]
37+
loader: "ts-loader",
38+
},
39+
],
4240
},
4341
optimization: {
4442
nodeEnv: "production",
45-
minimize: false
46-
}
43+
minimize: false,
44+
},
4745
};

0 commit comments

Comments
 (0)