同步代码

This commit is contained in:
FishOrBear
2020-05-07 10:51:27 +08:00
parent 85db279fab
commit e712b7b4e2
10 changed files with 492 additions and 17 deletions

View File

@@ -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" },

View File

@@ -8,6 +8,9 @@ const config: webpack.Configuration = merge(
{
mode: "production",
entry: "./src/index.ts",
externals: {
'three': "THREE"
},
//输出设置
output: {
filename: "cad.js",

View File

@@ -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;