1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- const path = require('path');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const CleanWebpackPlugin = require('clean-webpack-plugin');
- const CopyWebpackPlugin = require('copy-webpack-plugin');
- module.exports = {
- entry: './src/index.ts',
- devtool: 'inline-source-map',
- output: {
- filename: 'wcs.js',
- path: path.resolve(__dirname, 'dist')
- },
- optimization: {
- splitChunks: {
- chunks: 'all'
- }
- },
- devServer: {
- contentBase: path.join(__dirname, "dist"),
- //port:4090, //指定端口号,默认是8080
- host:'0.0.0.0',
- //hot:true
- },
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- use: 'ts-loader',
- exclude: /node_modules/,
- }]
- },
- resolve: {
- extensions: ['.tsx', '.ts', '.js']
- },
- externals: {
- jquery: 'jQuery',
- three: 'THREE',
- },
- plugins: [
- new CleanWebpackPlugin(['dist']),
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: 'index.html',
- inject: true
- }),
- new CopyWebpackPlugin([
- {
- from: path.resolve(__dirname, 'static'),
- to: path.resolve(__dirname, 'dist','static'),
- ignore: ['.*']
- }])
- ]
- }
|