代码拉取完成,页面将自动刷新
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyFilePlugin = require('copy-webpack-plugin')
const publicPath = '/'
module.exports = {
// entry: './src/index.js',
entry: './src/view3d.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'view3d.bundle.js',
publicPath: publicPath
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}, {
test: /\.scss$/,
use: ["style-loader", 'css-loader', 'sass-loader']
},
{
test: /\.(js|jsx)$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // 自动刷新。
// new ExtractTextPlugin("[name].css"),
// new HtmlWebpackPlugin({ template: './src/index.html' }),
new HtmlWebpackPlugin({ template: './src/threejs.html' }),
new CopyFilePlugin({
patterns: [
{
from: __dirname + '/src/assets',
to: __dirname + '/dist/assets'
}
]
})
],
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
open: true,
hot: true,
port: 9001
},
mode: 'development'
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。