同步代码
This commit is contained in:
@@ -2,26 +2,30 @@ import * as HardSourceWebpackPlugin from 'hard-source-webpack-plugin';
|
||||
import * as webpack from 'webpack';
|
||||
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
const TS_LOADER = [
|
||||
{ loader: 'cache-loader', options: { cacheDirectory: "node_modules/.cache_loader" } },
|
||||
{
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true,
|
||||
experimentalWatchApi: true,
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
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,
|
||||
},
|
||||
use: TS_LOADER,
|
||||
},
|
||||
{ test: /\.css$/, loader: ['style-loader', 'css-loader'] },
|
||||
{ test: /\.[(jpg)|(png)|(obj)|(json)]$/, loader: "url-loader" },
|
||||
|
@@ -8,6 +8,9 @@ const config: webpack.Configuration = merge(
|
||||
{
|
||||
mode: "production",
|
||||
entry: "./src/index.ts",
|
||||
externals: {
|
||||
'three': "THREE"
|
||||
},
|
||||
//输出设置
|
||||
output: {
|
||||
filename: "cad.js",
|
||||
|
@@ -9,7 +9,7 @@ const config: webpack.Configuration = merge(
|
||||
mode: "development",
|
||||
entry: "./src/ViewSrc/index.ts",
|
||||
output: { pathinfo: false },
|
||||
devtool: "cheap-module-eval-source-map",
|
||||
devtool: "eval-source-map",
|
||||
devServer: {
|
||||
contentBase: "./dist/",
|
||||
port: 7776,
|
||||
@@ -26,6 +26,4 @@ const config: webpack.Configuration = merge(
|
||||
}
|
||||
);
|
||||
|
||||
config.externals = {};
|
||||
|
||||
export default config;
|
||||
|
Reference in New Issue
Block a user