代码拉取完成,页面将自动刷新
const path = require('path');
var webpack = require('webpack');
const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = {
entry: {
// ueditor_config: ['./app/lib/ueditor1.4.3.3/ueditor.config.js'],
// ueditor_all: ['./app/lib/ueditor1.4.3.3/ueditor.all.js'],
app: './app/index.js',
vendor: ['angular', 'oclazyload']
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [{
loader: "css-loader"
}]
})
},
{
test: /\.scss$/,
use: [{
loader: "style-loader" // 将 JS 字符串生成为 style 节点
}, {
loader: "css-loader" // 将 CSS 转化成 CommonJS 模块
}, {
loader: "sass-loader" // 将 Sass 编译成 CSS
}]
},
{
test: /\.(png|jpg|gif)$/,
use: [{
loader: 'url-loader',
options: {}
}]
},
{
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
use: [{
loader: 'url-loader',
options: {}
}]
},
{
test: /\.html$/,
loader: 'raw-loader',
exclude: /node_modules/
}
]
},
plugins: [
new ExtractTextPlugin("styles.css"),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'angular',
template: 'build/index.html',
hash: true,
// chunks: ['ueditor_config', 'ueditor_all','app','vendor']
}),
new webpack.DefinePlugin({
ON_DEMO: process.env.NODE_ENV === 'demo'
}),
new CopyWebpackPlugin([
// {
// from: path.resolve(__dirname, './app/lib/ueditor1.4.3.3'),
// to: path.resolve(__dirname, './dist/lib/ueditor1.4.3.3'),
// ignore: ['.*']
// },
// {
// from: path.resolve(__dirname, './node_modules/ztree'),
// to: path.resolve(__dirname, './dist/ztree'),
// ignore: ['.*']
// }
])
],
optimization: {
splitChunks: {
name: 'vendor',
filename: 'vendor.bundle.js'
}
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
}
};
module.exports = config;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。