Skip to content

Commit dc50074

Browse files
committed
upgrade copy-webpack-plugin
1 parent feb0c92 commit dc50074

File tree

9 files changed

+51
-17
lines changed

9 files changed

+51
-17
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ chunk5: libs/react
275275
If you use copy-webpack-plugin for example, you can use `html-res-webpack-plugin` easily. For example, if you copy `/xxx/libs` folder to `libs/`. If the folder contains `react` and `react-dom`, you can add chunks `libs/react/` and `libs/react-dom` in `html-res-webpack-plugin`.
276276

277277
```javascript
278+
278279
plugins: [
279280
new CopyWebpackPlugin([
280281
{
@@ -294,6 +295,25 @@ plugins: [
294295
],
295296
}),
296297
]
298+
299+
300+
plugins: [
301+
new CopyWebpackPlugin([
302+
{
303+
from: '/xxx/libs/',
304+
to: 'libs/[name]-[hash:6].[ext]'
305+
}
306+
]),
307+
new HtmlResWebpackPlugin({
308+
filename: "index.html",
309+
template: config.path.src + "/resource-copy-plugin-1/index.html",
310+
chunks:[
311+
'libs/react',
312+
'libs/react-dom',
313+
'js/index',
314+
],
315+
}),
316+
]
297317
```
298318

299319
## Options

README_ZH.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ chunk5: libs/react
274274

275275

276276
```javascript
277+
277278
plugins: [
278279
new CopyWebpackPlugin([
279280
{
@@ -293,6 +294,25 @@ plugins: [
293294
],
294295
}),
295296
]
297+
298+
299+
plugins: [
300+
new CopyWebpackPlugin([
301+
{
302+
from: '/xxx/libs/',
303+
to: 'libs/[name]-[hash:6].[ext]'
304+
}
305+
]),
306+
new HtmlResWebpackPlugin({
307+
filename: "index.html",
308+
template: config.path.src + "/resource-copy-plugin-1/index.html",
309+
chunks:[
310+
'libs/react',
311+
'libs/react-dom',
312+
'js/index',
313+
],
314+
}),
315+
]
296316
```
297317

298318
## Options

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-res-webpack-plugin",
3-
"version": "1.2.6",
3+
"version": "1.3.0",
44
"description": "html generation and resource inline or md5 for webpack",
55
"keywords": [
66
"front-end",
@@ -39,7 +39,7 @@
3939
"babel-core": "^6.1.4",
4040
"babel-loader": "^6.1.0",
4141
"babel-preset-es2015": "^6.1.4",
42-
"copy-webpack-plugin-hash": "^3.0.2",
42+
"copy-webpack-plugin-hash": "^4.0.1",
4343
"css-loader": "^0.22.0",
4444
"extract-text-webpack-plugin-steamer": "^1.0.1",
4545
"file-loader": "^0.8.4",

specWebpack/.DS_Store

0 Bytes
Binary file not shown.

specWebpack/runWebpack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ var webpackConfig = [
2323
require(basePath + '/resource-favico1/webpack.config.js'), // html mode generate favicon
2424
require(basePath + '/resource-common-1/webpack.config.js'), // common chunk generated by webpack
2525
require(basePath + '/resource-common-2/webpack.config.js'), // html mode common chunk generated by webpack
26-
require(basePath + '/resource-copy-plugin-1/webpack.config.js'), // usage with copy-webpack-plugin
27-
require(basePath + '/resource-copy-plugin-2/webpack.config.js'), // usage with copy-webpack-plugin
28-
require(basePath + '/resource-copy-plugin-3/webpack.config.js'), // html mode usage with copy-webpack-plugin
26+
require(basePath + '/resource-copy-plugin-1/webpack.config.js'), // usage with copy-webpack-plugin-hash
27+
require(basePath + '/resource-copy-plugin-2/webpack.config.js'), // usage with copy-webpack-plugin-hash
28+
require(basePath + '/resource-copy-plugin-3/webpack.config.js'), // html mode usage with copy-webpack-plugin-hash
2929
require(basePath + '/resource-external-1/webpack.config.js'), // external resource
3030
require(basePath + '/image-in-html/webpack.config.js'), // image in html
3131
require(basePath + '/resource-attr-1/webpack.config.js'), // resource attribute

specWebpack/src/.DS_Store

-10 KB
Binary file not shown.

specWebpack/src/resource-copy-plugin-1/webpack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ module.exports = {
6969
new CopyWebpackPlugin([
7070
{
7171
from: config.path.src + '/resource-copy-plugin-1/libs/',
72-
to: 'libs/'
72+
to: 'libs/[name]' + config.hash + '.[ext]'
7373
}
74-
], {
75-
namePattern: "[name]-[contenthash:6].js"
76-
}),
74+
]),
7775
new HtmlResWebpackPlugin({
7876
filename: "index.html",
7977
template: config.path.src + "/resource-copy-plugin-1/index.html",

specWebpack/src/resource-copy-plugin-2/webpack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ module.exports = {
6868
new CopyWebpackPlugin([
6969
{
7070
from: config.path.src + '/resource-copy-plugin-2/libs/',
71-
to: 'libs/'
71+
to: 'libs/[name]' + config.hash + '.[ext]'
7272
}
73-
], {
74-
namePattern: "[name]-[contenthash:6].js"
75-
}),
73+
]),
7674
new HtmlResWebpackPlugin({
7775
filename: "index.html",
7876
template: config.path.src + "/resource-copy-plugin-2/index.html",

specWebpack/src/resource-copy-plugin-3/webpack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ module.exports = {
6868
new CopyWebpackPlugin([
6969
{
7070
from: config.path.src + '/resource-copy-plugin-3/libs/',
71-
to: 'libs/'
71+
to: 'libs/[name]' + config.hash + '.[ext]'
7272
}
73-
], {
74-
namePattern: "[name]-[contenthash:6].js"
75-
}),
73+
]),
7674
new HtmlResWebpackPlugin({
7775
mode: "html",
7876
filename: "index.html",

0 commit comments

Comments
 (0)