解决typescript webpack 设置alias不生效的问题

tsconfig.json

特别注意includesexclude!!

    "paths": {
      "@/*": ["./app/*"],
    }
    ....
      "exclude": ["node_modules", "dist", "src", ],
	  "includes": ["./app/**/*", "./chrome/**/*", ]

webpack.config.js

 resolve: {
    extensions: ['.ts', '.tsx', '.js', '.jsx'],
    alias: {
      '@': path.resolve(__dirname, 'app'),
    },
  },
   module: {
    rules: [{
        test: /\.tsx?$/,
        exclude: /node_modules/,
        loader: 'awesome-typescript-loader',
      },]}

你可能感兴趣的:(typescript,webpack,问题记录)