import * as path from 'path'; import * as webpack from 'webpack'; import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); import * as HardSourceWebpackPlugin from 'hard-source-webpack-plugin'; const config: webpack.Configuration = { devtool: "source-map", //项目需要解析的文件拓展名称 resolve: { extensions: [".ts", ".tsx", ".js", "json"] }, externals: { 'three': "THREE" }, //模块加载器设置 module: { rules: [ { test: /\.tsx?$/, exclude: /node_modules/, loader: 'ts-loader', options: { transpileOnly: true, experimentalWatchApi: true, }, }, { 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;