CADViewComponent/config/webpack.common.ts

42 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2018-10-12 17:02:10 +08:00
import * as HardSourceWebpackPlugin from 'hard-source-webpack-plugin';
2018-08-17 21:26:32 +08:00
import * as webpack from 'webpack';
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2020-05-07 10:51:27 +08:00
const TS_LOADER = [
{ loader: 'cache-loader', options: { cacheDirectory: "node_modules/.cache_loader" } },
{
loader: 'ts-loader',
options: {
transpileOnly: true,
experimentalWatchApi: true,
},
}
];
2018-08-17 21:26:32 +08:00
const config: webpack.Configuration = {
devtool: "source-map",
//项目需要解析的文件拓展名称
resolve: {
extensions: [".ts", ".tsx", ".js", "json"]
},
//模块加载器设置
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
2020-05-07 10:51:27 +08:00
use: TS_LOADER,
2018-08-17 21:26:32 +08:00
},
{ test: /\.css$/, loader: ['style-loader', 'css-loader'] },
{ test: /\.[(jpg)|(png)|(obj)|(json)]$/, loader: "url-loader" },
]
},
plugins: [
new HardSourceWebpackPlugin(),
new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true }),
]
}
export default config;