LoginSignup
0
0

More than 5 years have passed since last update.

TypeScript メモ 2

Last updated at Posted at 2018-09-09

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" }
    ]
  }
};

とりあえずはこの感じで治ったとゆう感じです。

まだまだいい方法がありそうな気がしますので、模索します。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0