1 Star 0 Fork 2

甘锋/angularjs_webpack

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
甘锋 提交于 2023-05-06 00:19 . 新增多层级组件
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;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ganfeng/angularjs_webpack.git
[email protected]:ganfeng/angularjs_webpack.git
ganfeng
angularjs_webpack
angularjs_webpack
master

搜索帮助