CADViewComponent/config/webpack.umd.ts

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-08-17 17:39:11 +08:00
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;