tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "es2015",
"jsx": "react",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": true,
"skipLibCheck": true,
"baseUrl": ".",
"lib": ["dom", "es2018"]
}
}
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist/js",
"rootDir": "src/ts",
"target": "es5",
"sourceMap": true,
"types" : ["node"]
},
"exclude": [
"dist",
"node_modules"
]
}
どっちがいいのかなWWW
webpack.config.js
const path = require("path");
module.exports = {
context: path.resolve(__dirname, "./"),
entry: {
app: "./src/react/app.tsx" //ここを増やす
},
target: "node",
output: {
path: path.resolve(__dirname, "./"),
filename: "./dist/public/react/app.js"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
}
};
とりあえずはこの感じで治ったとゆう感じです。
まだまだいい方法がありそうな気がしますので、模索します。