Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
ESM build (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
webcarrot committed Sep 30, 2022
1 parent 263d61d commit 5c0391d
Show file tree
Hide file tree
Showing 15 changed files with 1,989 additions and 4,030 deletions.
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

7 changes: 0 additions & 7 deletions context.ts

This file was deleted.

2 changes: 1 addition & 1 deletion example/node/plain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const handler = async (
if (context.path === "/plain") {
const api = makeApi<ApiData, KoaContext>({
actions,
context
context,
});
context.body = (await api("say.hi", { who: "plain-node" })).hi;
} else {
Expand Down
5,124 changes: 1,231 additions & 3,893 deletions example/package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
},
"license": "MIT",
"dependencies": {
"@webcarrot/api": "^1.8.1",
"@webcarrot/api": "file:../webcarrot-api-1.8.1.tgz",
"co-body": "^6.1.0",
"koa": "^2.13.4",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/co-body": "6.1.0",
"@types/koa": "^2.13.4",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"awesome-typescript-loader": "^5.2.1",
"typescript": "^4.7.2",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"
"@types/koa": "^2.13.5",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"ts-loader": "^9.4.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
}
}
30 changes: 14 additions & 16 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
const { join } = require("path");

const { TsConfigPathsPlugin } = require("awesome-typescript-loader");
const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin");
const { DefinePlugin } = require("webpack");

module.exports = {
entry: join(__dirname, "./browser/react.ts"),
output: {
path: join(__dirname, "./build"),
filename: "./build/react.js",
publicPath: "/build"
publicPath: "/build",
},
watch: false,
mode: "production",
devtool: "inline-source-map",
externals: {
react: "React",
"react-dom": "ReactDOM"
"react-dom": "ReactDOM",
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
plugins: [
new TsConfigPathsPlugin({
tsconfig: join(__dirname + "./tsconfig.webpack.json"),
compiler: "typescript"
})
]
new TsconfigPathsPlugin({
configFile: join(__dirname, "./tsconfig.webpack.json"),
}),
],
},
plugins: [
new DefinePlugin({
NODE_ENV: JSON.stringify("production"),
"process.env.NODE_ENV": JSON.stringify("production")
})
"process.env.NODE_ENV": JSON.stringify("production"),
}),
],
module: {
rules: [
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader"
}
]
loader: "ts-loader",
},
],
},
optimization: {
nodeEnv: "production",
minimize: false
}
minimize: false,
},
};
Loading

0 comments on commit 5c0391d

Please sign in to comment.