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. centos7+python+selenium+chrome

    1.安装chrome yum install google-chrome 2.安装chromedriver所有版本的下载地址:https://sites.google.com/a/chromium.o ...

  2. SpringMVC听课笔记(十一:国际化)

    1. 关于国际化 -- 在页面上根据浏览器的语言设置情况对文本(不是内容),时间,数值进行本地化处理 使用JSTL的fmt标签 -- 可以在bean中获取国际化资源文件 Locale对应的消息 在be ...

  3. java项目相对路径

    ./的含义: eclipse相对路径是相对项目的src目录来说的,而不是相对于当前文件. "./某某文件.txt" 而idea则相对于项目根目录 "./src/某某文件. ...

  4. 高性能缓存 Caffeine 原理及实战

    一.简介 Caffeine 是基于Java 8 开发的.提供了近乎最佳命中率的高性能本地缓存组件,Spring5 开始不再支持 Guava Cache,改为使用 Caffeine. 下面是 Caffe ...

  5. React---路由跳转

    最近在开发react的项目中,很多地方都是使用组件式的跳转方式,但是怎么样使用js去控制页面的跳转呢? withRouter withRouter 是一个高阶组件,把 match,location,h ...

  6. kubernetes 身份与权限认证 (ServiceAccount && RBAC)

    Kubernetes中提供了良好的多租户认证管理机制,如RBAC.ServiceAccount还有各种Policy等.   ServiceAccount Service Account为Pod中的进程 ...

  7. MySQL数据库操作生成UUID

    问题描述: 通过数据库操作,生成无横线的uuid,同时插入至数据库之中. 因为我要给项目做一些测试数据,项目的主键为32位无'-'的uuid,然后在数据库中,通过数据库操作,然后插入一些测试数据. 生 ...

  8. Python 学习博客地址

    Alex  https://www.cnblogs.com/alex3714林海峰 https://www.cnblogs.com/linhaifeng武佩奇 https://www.cnblogs. ...

  9. 18.RAID介绍和部署磁盘阵列

    1.RAID RAID(Redundant Array of Independent Disks,独立冗余磁盘阵列)技术具备的冗余备份机制以及提升了的硬盘吞吐量. 1)RAID 0:把多块物理硬盘设备 ...

  10. [SpringSecurity] UserDetailsService 详解

    UserDetailsService 接口 当什么也没有配置的时候,账号和密码是由 Spring Security 定义生成的. 而在实际项目中账号和密码都是从数据库中查询出来的. 所以我们要通过自定 ...