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的更多相关文章

  1. 如何开发webpack plugin

    继上回介绍了如何开发webpack loader 之后.趁热打铁,来继续看下webpack另一个核心组成:plugin. 下面也和loader一样,让我们一起从基本的官方文档着手看起. loader和 ...

  2. 简单webpack plugin 开发

    重要是学习下怎么开发webpack plugin,同时记录下 插件模型 webpack 是一个插件,可以是javascript class ,或者具名 class 定义apply 方法 指定一个绑定到 ...

  3. Webpack Plugin

    [Webpack Plugin] Since Loaders only execute transforms on a per-file basis, plugins are most commonl ...

  4. 问题: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.” ...

  5. 案例实战之如何写一个webpack plugin

    案例实战之如何写一个webpack plugin 1.写一个生成打包文件目录的file.md文件 // 生成一个目录项目目录的文件夹 class FileListPlugin { constructo ...

  6. 揭秘webpack plugin

    前言 Plugin(插件) 是 webpack 生态的的一个关键部分.它为社区提供了一种强大的方法来扩展 webpack 和开发 webpack 的编译过程.这篇文章将尝试探索 webpack plu ...

  7. YYDS: Webpack Plugin开发

    目录 导读 一.cdn常规使用 二.开发一个webpack plugin 三.cdn优化插件实现 1.创建一个具名 JavaScript 函数(使用ES6的class实现) 2.在它的原型上定义 ap ...

  8. eclipse cut copy paste plugin

    The Cut Copy Paste Plus plug-in enhances the standard Cut, Copy and Paste commands in Eclipse IDE. W ...

  9. 爱搞事情的webpack

    webpack 是一个现代 JavaScript 应用程序的静态模块打包器(module bundler). 当 webpack 处理应用程序时,它会递归地构建一个依赖关系图(dependency g ...

随机推荐

  1. jquery 数据查询

    jquery 数据查询 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> & ...

  2. Python_ 1生成器(上)初识生成器

    引言:列表生成式 现在有个需求,给定列表[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],现在要求你把列表里的每个值加1,你怎么实现?你可能会想到2种方式 1 >>> a ...

  3. CF1190B

    扯在前面 我们老师刚讲过的题目,很考验思维,本蒟蒻WA了十发才过,然后看到题解里只是指出了特殊情况没多解释,可能有人看不懂,特来分享一下 首先题目就很有意思,思考的过程也很有趣,想把所有情况思考全思考 ...

  4. 在 ASP.NET Core 应用中使用 Cookie 进行身份认证

    Overview 身份认证是网站最基本的功能,最近因为业务部门的一个需求,需要对一个已经存在很久的小工具网站进行改造,因为在逐步的将一些离散的系统迁移至 .NET Core,所以趁这个机会将这个老的 ...

  5. Java获取类路径的方式

    Java环境中,如何获取当前类的路径.如何获取项目根路径等: @Test public void showURL() throws IOException { // 第一种:获取类加载的根路径 Fil ...

  6. 封装打包Python脚本

    1.前言 封装打包Python的好处,节省了安装各种各样包依赖的问题,同时可以加强我们代码隐私的安全性,这里我的演示环境是Python3.6 ,CentOS7的系统,同时打包工具采用pyinstall ...

  7. 关于RabbitMQ的简单理解

    说明:想要理解RabbitMQ,需要先理解MQ是什么?能做什么?然后根据基础知识去理解RabbitMQ是什么.提供了什么功能. 一.MQ的简单理解 1. 什么是MQ? 消息队列(Message Que ...

  8. JVM系列(一):jvm启动过程速览

    jvm是java的核心运行平台,自然是个非常复杂的系统.当然了,说jvm是个平台,实际上也是个泛称.准确的说,它是一个java虚拟机的统称,它并不指具体的某个虚拟机.所以,谈到java虚拟机时,往往我 ...

  9. JVM之JVM体系结构

    JVM是运行在操作系统之上的,它与硬件没有直接的交互 下图运行时数据区灰色代表线程私有,亮色(方法区和堆)代表所有线程共享. 1.类装载器ClassLoader 负责加载class文件,class文件 ...

  10. windows10与linux进行ftp遇到550 Failed to change directory及553 Could not creat file

    第一个原因: 没有权限,可以使用带有l参数的ls命令来看文件或者目录的权限 ls -l 解决:给本地用户添加一个可写权限 chmod +w /home/student ##给对应的本地用户添加一个可写 ...