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 ...
随机推荐
- jQuery 自动生成二维码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http ...
- 【python刷题】LRU
什么是LRU? LRU是Least Recently Used的缩写,即最近最少使用,是一种常用的页面置换算法,选择最近最久未使用的页面予以淘汰.该算法赋予每个页面一个访问字段,用来记录一个页面自上次 ...
- openrstry 限流 是否有清零逻辑 连接池
openrstry 限流 是否有清零逻辑 https://github.com/openresty/lua-resty-limit-traffic # encoding=utf-8 # Shawn ...
- 分布式跟踪的一个流行标准是OpenTracing API,该标准的一个流行实现是Jaeger项目。
https://github.com/jaegertracing/jaeger https://mp.weixin.qq.com/s/-Tn2AgyHoq8pwMun8JHcGQ Jaeger的深入分 ...
- bcprov-jdk15on包用于创建CSR(证书请求)
<!-- Eureka注册中心客户端依赖 --> <dependency> <groupId>org.springframework.cloud</group ...
- HMS Core华为分析丨受众细分,多场景促进精益运营
用户的偏好不同,对产品的需求也不一样,要想更好地培养用户粘性,就需要因人施策,精细化运营,而受众细分是精细化运营的重要方法之一.受众细分是根据用户属性和行为数据,将具有相同或类似特征的用户归为一个群组 ...
- Linux性能分析:生产环境服务器变慢,诊断思路和性能评估
Linux性能分析:生产环境服务器变慢,诊断思路和性能评估 一.整机:top 二.CPU:vmstat 所有CPU核信息 每个进程使用CPU的用量分解信息 三.内存:free 四.硬盘:df 五.磁盘 ...
- 函数式编程(__slots__)
正常情况下,当我们定义了一个class,创建了一个class的实例后,我们可以给该实例绑定任何属性和方法,这就是动态语言的灵活性.先定义class: class Student(object): pa ...
- java的volatile关键字(笔记)
Volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值.而且,当成员变量发生变化时,强迫线程将变化值回写到主内存.这样在任何时刻,两个不同的线程总是看到某个成员变量的同一 ...
- java正则表示判断。是否以某个关键字结尾的
String defaultPageSqlId = ".*ByPaging$"; System.out.println("dsdsdsdByPaging".ma ...