copy-webpack-plugin & ignore folder
copy-webpack-plugin & ignore folder
https://github.com/webpack-contrib/copy-webpack-plugin#ignore
ignore bug
not ignore folders
copy-webpack-plugin ignore folder
https://github.com/webpack-contrib/copy-webpack-plugin/issues/54
OK
ignore
folder
&any thing in the folder
==="libs/**/*"
ignore some
.extension
files ===["*.md", "*.js", "*.css" ]
// ignore folder & any thing in the folder === "libs/**/*"
// ignore some .extension files === ["*.md", "*.js", "*.css" ]
new CopyWebpackPlugin([
{
from: "./src/backend-system/",
to: "../",
ignore: ["*.md", "*.js", "*.css", "others/*", "libs/**/*"]
},
{
from: "./src/backend-system/index.css",
to: "./css/"
}
]),
ignore bug
not ignore folders
copy-webpack-plugin ignore folder
https://github.com/webpack-contrib/copy-webpack-plugin/issues/54
OK
ignore
folder
&any thing in the folder
==="libs/**/*"
ignore some
.extension
files ===["*.md", "*.js", "*.css" ]
// ignore folder & any thing in the folder === "libs/**/*"
// ignore some .extension files === ["*.md", "*.js", "*.css" ]
new CopyWebpackPlugin([
{
from: "./src/backend-system/",
to: "../",
ignore: ["*.md", "*.js", "*.css", "others/*", "libs/**/*"]
},
{
from: "./src/backend-system/index.css",
to: "./css/"
}
]),
bad
perfect
new CopyWebpackPlugin([
// {
// from: "./src/imgs",
// to: "./imgs/",
// ignore: ["*.md"]
// },
// {
// from: "./src/templates",
// to: "./templates/",
// ignore: ["*.md"]
// },
// {
// from: "./favicon.ico",
// to: "./"
// },
// {
// from: "./src/backend-system/**/*.html",
// to: "../",
// ignore: ["others/*", "libs/**/*"]
// },
{
from: "./src/backend-system/",
to: "../",
ignore: ["*.png", "*.md", "*.js", "*.css", "others/*", "libs/**/*"]
},
{
from: "./src/backend-system/layui.css",
to: "../css/"
},
{
from: "./src/backend-system/index.css",
to: "../css/"
},
{
from: "./src/backend-system/icon.png",
to: "../css/"
}
]),
webpack.config.js
"use strict";
/**
* @Created by xgqfrms on 2016/1/26.
* @version 1.0.0 created
* @description APDP\webpack.config.js
* @author xgqfrms
*
* @license MIT
* @copyright xgqfrms 2016-forever || 2018-present
*
*/
const path = require("path");
const webpack = require("webpack");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
require("babel-polyfill");
const extractSCSS = new ExtractTextPlugin({
filename: (getPath) => {
// relative path
return getPath("../css/[name].min.css?[hash:8]");
},
// allChunks: true,
});
// process.env.NODE_ENV = `production`;
process.env.NODE_ENV = `development`;
if (process.env.NODE_ENV !== "production") {
console.log(", Looks like we are in development mode!");
}else{
console.log("Tada, , we are in production mode!");
}
const BASE_URI = {
index: `./index`,
MODULES: `./src/backend-system`,
FES: `./src/frontend-system`,
BS: `./src/backend-system/select-tree`,
COMPONENTS: `./table-components`,
TEST: `./table-components/test`,
app: "select-tree",
};
const modulesArray = [
"index",// index & "babel-polyfill",
"urls",
"layui",// just for minify css
"select-tree",
"project-table",
"project-form",
"svn-table",
"svn-form",
"service-table",
"service-form",
];
const fesArray = [
// "index",// index & "babel-polyfill"
"project-table",
"project-form",
"server-table",
"server-form",
"logs-tree",
"config-tree",
];
const tableComponents = [
"basic-table",
"fixed-header-table",
"fixed-column-table",
"fixed-row-table",
"fixed-header-column-table"
// "fixed-rows-table",
// "fixed-cols-table",
];
const tableTest = [
"basic-table.spec",
"fixed-header-table.spec",
"fixed-column-table.spec",
"fixed-row-table.spec",
"fixed-header-column-table.spec",
// "fixed-rows-table.spec",
// "fixed-cols-table.spec",
];
let entryObject = {};
// entryObject["babel-polyfill"] = "babel-polyfill";
// entryObject["select-tree"] = ["babel-polyfill", `${BASE_URI.BS}`];
// entryObject[`${BASE_URI.app}`] = ["babel-polyfill", `${BASE_URI.BS}`];
modulesArray.forEach(
(item, i) => {
// entryObject[item] = ["babel-polyfill", `${BASE_URI.MODULES}/${item}`];
// only entry & import "babel-polyfill";
entryObject[item] = `${BASE_URI.MODULES}/${item}`;
}
);
// fesArray.forEach(
// (item, i) => {
// entryObject[item] = `${BASE_URI.FES}/${item}`;
// }
// );
// tableComponents.forEach(
// (item, i) => {
// entryObject[item] = `${BASE_URI.COMPONENTS}/${item}`;
// }
// );
// tableTest.forEach(
// (item, i) => {
// entryObject[item] = `${BASE_URI.TEST}/${item}`;
// }
// );
module.exports = {
entry: Object.assign({}, entryObject),
output: {
path: path.resolve(__dirname, "build/js/"),
filename: "[name].min.js",
},
resolve: {
extensions: [".js",".css"]
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
},
{
test: /\.((s*)css|sass)$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: "css-loader",
options: {
url: false,
// url: true,
minimize: true,
sourceMap: true,
modules: true,
importLoaders: 1,
localIdentName: "[local]",
}
},
{
loader: "sass-loader",
options: {
sourceMap: true,
}
}
],
fallback: "style-loader",
}),
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
},
]
},
devtool: "source-map",
plugins: [
new UglifyJSPlugin({
sourceMap: true,
// extractComments: false,
extractComments: true,
parallel: 4,
cache: true,
}),
extractSCSS,
new CopyWebpackPlugin([
// {
// from: "./src/imgs",
// to: "./imgs/",
// ignore: ["*.md"]
// },
// {
// from: "./src/templates",
// to: "./templates/",
// ignore: ["*.md"]
// },
// {
// from: "./favicon.ico",
// to: "./"
// },
// {
// from: "./src/backend-system/**/*.html",
// to: "../",
// ignore: ["others/*", "libs/**/*"]
// },
{
from: "./src/backend-system/",
to: "../",
ignore: ["*.png", "*.md", "*.js", "*.css", "others/*", "libs/**/*"]
},
// {
// from: "./src/backend-system/layui.css",
// to: "../css/"
// },
// {
// from: "./src/backend-system/index.css",
// to: "../css/"
// },
{
from: "./src/backend-system/icon.png",
to: "../css/"
}
]),
],
// devServer: {
// contentBase: path.resolve(__dirname, `dist`),
// host: `http://10.1.5.202`,
// compress: true,
// port: 8080
// },
};
refs
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
copy-webpack-plugin & ignore folder的更多相关文章
- 如何开发webpack plugin
继上回介绍了如何开发webpack loader 之后.趁热打铁,来继续看下webpack另一个核心组成:plugin. 下面也和loader一样,让我们一起从基本的官方文档着手看起. loader和 ...
- 简单webpack plugin 开发
重要是学习下怎么开发webpack plugin,同时记录下 插件模型 webpack 是一个插件,可以是javascript class ,或者具名 class 定义apply 方法 指定一个绑定到 ...
- Webpack Plugin
[Webpack Plugin] Since Loaders only execute transforms on a per-file basis, plugins are most commonl ...
- 问题:Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder.
创建AVD时,发现创建不成功,报错“Unable to find a 'userdata.img' file for ABIarmeabi to copy into the AVD folder.” ...
- 案例实战之如何写一个webpack plugin
案例实战之如何写一个webpack plugin 1.写一个生成打包文件目录的file.md文件 // 生成一个目录项目目录的文件夹 class FileListPlugin { constructo ...
- 揭秘webpack plugin
前言 Plugin(插件) 是 webpack 生态的的一个关键部分.它为社区提供了一种强大的方法来扩展 webpack 和开发 webpack 的编译过程.这篇文章将尝试探索 webpack plu ...
- YYDS: Webpack Plugin开发
目录 导读 一.cdn常规使用 二.开发一个webpack plugin 三.cdn优化插件实现 1.创建一个具名 JavaScript 函数(使用ES6的class实现) 2.在它的原型上定义 ap ...
- eclipse cut copy paste plugin
The Cut Copy Paste Plus plug-in enhances the standard Cut, Copy and Paste commands in Eclipse IDE. W ...
- 爱搞事情的webpack
webpack 是一个现代 JavaScript 应用程序的静态模块打包器(module bundler). 当 webpack 处理应用程序时,它会递归地构建一个依赖关系图(dependency g ...
随机推荐
- Python虚拟环境配置应用
Python好用,但用好却不易,其中比较头疼的就是包管理和Python不同版本的问题,为了解决这些问题,有不少发行版的Python,比如WinPython.Anaconda等,这些发行版将python ...
- Linux下运行java报错:Error: Could not find or load main class SocketIOPropertites
[root@node01 testfileio]# javac SocketIOPropertites.java && java Soc ketIOPropertitesError: ...
- 配置MySQL主从复制报错Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work
配置MySQL主从复制报错 ``` Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave ha ...
- 蓝 / 绿部署(Blue/Green) 金丝雀发布(Canary Release) 功能标记(Feature Flagging)
https://www.cnblogs.com/apanly/p/8784096.html 最终,我选择了 GraphQL 作为企业 API 网关 蓝 / 绿部署(Blue/Green) 金丝雀发布( ...
- Redis集群拆分原则之AKF
当我们搭建集群的时候,首先要想明白需要解决哪些问题,搞清楚这个之前,想想单节点.单实例.单机有哪些问题? 单点故障 容量有限 可支持的连接有限(性能不足) ...... 为了解决这些问题,我们需要对服 ...
- 洛谷P3413 P6754
双倍经验题 由于我先做的 P6754,所以一切思路基于 P6754 的题目 " P6754 这题就是 P3413 的究极弱化版 " --By Aliemo. P6754 Descr ...
- 利用Javascript制作网页特效(其他常见特效)
设置为首页和加入收藏夹 ①:在body标签内输入以下代码: <a onclick="this.style.behavior='url(#default#homepage)'; this ...
- 设计模式c++(3)——观察者模式
观察者模式定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,它的所有依赖着都会收到通知并自动更新. 当两个对象之间松耦合,他们依然可以交互,但是不太清楚彼此的细节.观察者模式提供了一种对象设 ...
- Redis挖矿原理及防范
笔者也曾经被挖矿病毒侵袭过,灰常难受,但是其实你只要了解入侵的手段就非常好防范了,今天我们就演示一下如果通过Redis进行提权获取远程服务器的Root用户. 1.首先我们需要一些先决条件 条件一:你首 ...
- 最短路-SPFA算法&Floyd算法
SPFA算法 算法复杂度 SPFA 算法是 Bellman-Ford算法 的队列优化算法的别称,通常用于求含负权边的单源最短路径,以及判负权环. SPFA一般情况复杂度是O(m)最坏情况下复杂度和朴素 ...