48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
![]() |
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 = {
|
||
|
mode: "production",
|
||
|
entry: "./src/index.ts",
|
||
|
devtool: "source-map",
|
||
|
//输出设置
|
||
|
output: {
|
||
|
filename: "cad.js",
|
||
|
path: path.resolve(__dirname, '../umd'),
|
||
|
library: "cad",
|
||
|
libraryTarget: "umd"
|
||
|
},
|
||
|
//项目需要解析的文件拓展名称
|
||
|
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;
|