-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid recompiling all entry templates after changes of a non-ent…
…ry partial file
- Loading branch information
Showing
25 changed files
with
269 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Problem `FIXED` in v3.6.2 | ||
|
||
Compiling all entrypoint files after changes of a non-entry file. | ||
|
||
**Project files** | ||
|
||
``` | ||
pages/home/index.html <= entrypoint | ||
pages/home/includes/header.html <= non entry partial | ||
pages/about/index.html <= entrypoint | ||
pages/about/includes/header.html <= non entry partial | ||
``` | ||
|
||
### Reproduce | ||
|
||
- change `pages/home/index.html` => will be rendered only this file. OK | ||
- change `pages/home/includes/header.html` => will be recompiled pages: | ||
- pages/home/index.html (with all dependencies), OK | ||
- pages/about/index.html (with all dependencies), NOT OK, should not be recompiled (`FIXED`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"scripts": { | ||
"start": "webpack serve --mode development", | ||
"watch": "webpack watch --mode development", | ||
"build": "webpack --mode=production --progress" | ||
}, | ||
"devDependencies": { | ||
"html-bundler-webpack-plugin": "file:../../.." | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
test/manual/watch-non-entry-partial-ejs/src/components/slider/slider.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="slider"> | ||
<div>Slide 1</div> | ||
<div>Slide 2</div> | ||
<div>Slide 3</div> | ||
</div> |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-ejs/src/views/pages/about-product/includes/header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>About product 123456789</h1> |
11 changes: 11 additions & 0 deletions
11
test/manual/watch-non-entry-partial-ejs/src/views/pages/about-product/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>About product</title> | ||
</head> | ||
<body> | ||
<%- include('./includes/header.html') %> | ||
<p>Test body: 123 45678</p> | ||
<%- include('../../../components/slider/slider.html') %> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-ejs/src/views/pages/about/includes/header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>About 123</h1> |
11 changes: 11 additions & 0 deletions
11
test/manual/watch-non-entry-partial-ejs/src/views/pages/about/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>About</title> | ||
</head> | ||
<body> | ||
<%- include('./includes/header.html') %> | ||
<p>Test body: 123 4567</p> | ||
<%- include('../../../components/slider/slider.html') %> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-ejs/src/views/pages/home/includes/header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Home 123</h1> |
11 changes: 11 additions & 0 deletions
11
test/manual/watch-non-entry-partial-ejs/src/views/pages/home/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Home</title> | ||
</head> | ||
<body> | ||
<%- include('./includes/header.html') %> | ||
<p>Test body: 123</p> | ||
<%- include('../../../components/slider/slider.html') %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('html-bundler-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'minimal', | ||
|
||
output: { | ||
path: path.join(__dirname, 'dist/'), | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
entry: { | ||
index: './src/views/pages/home/index.html', | ||
about: './src/views/pages/about/index.html', | ||
}, | ||
preprocessor: 'ejs', | ||
//preprocessor: false, | ||
//hotUpdate: true, | ||
//verbose: true, | ||
}), | ||
], | ||
|
||
// module: { | ||
// rules: [ | ||
// { | ||
// test: /\.(css)$/, | ||
// use: ['css-loader'], | ||
// }, | ||
// ], | ||
// }, | ||
|
||
// devServer: { | ||
// static: { | ||
// directory: path.join(__dirname, 'dist'), | ||
// }, | ||
// watchFiles: { | ||
// paths: ['src/**/*.*'], | ||
// options: { | ||
// usePolling: true, | ||
// }, | ||
// }, | ||
// }, | ||
|
||
watchOptions: { | ||
// fix twice recompilation the same file | ||
aggregateTimeout: 600, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Problem `FIXED` in v3.6.2 | ||
|
||
Compiling all entrypoint files after changes of a non-entry file. | ||
|
||
**Project files** | ||
|
||
``` | ||
pages/home/index.pug <= entrypoint | ||
pages/home/includes/header.pug <= non entry partial | ||
pages/about/index.pug <= entrypoint | ||
pages/about/includes/header.pug <= non entry partial | ||
``` | ||
|
||
### Reproduce | ||
|
||
- change `pages/home/index.pug` => will be rendered only this file. OK | ||
- change `pages/home/includes/header.pug` => will be recompiled pages: | ||
- pages/home/index.pug (with all dependencies), OK | ||
- pages/about/index.pug (with all dependencies), NOT OK, should not be recompiled (`FIXED`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"scripts": { | ||
"start": "webpack serve --mode development", | ||
"watch": "webpack watch --mode development", | ||
"build": "webpack --mode=production --progress" | ||
}, | ||
"devDependencies": { | ||
"html-bundler-webpack-plugin": "file:../../.." | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/manual/watch-non-entry-partial-pug/src/components/slider/slider.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.slider | ||
div Slide 1: 123 | ||
div Slide 2 | ||
div Slide 3 |
6 changes: 6 additions & 0 deletions
6
test/manual/watch-non-entry-partial-pug/src/views/layouts/default.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
html | ||
head | ||
block head | ||
body | ||
.nav Menu: 123 | ||
block body |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-pug/src/views/pages/about-product/includes/header.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1 About product |
9 changes: 9 additions & 0 deletions
9
test/manual/watch-non-entry-partial-pug/src/views/pages/about-product/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extends ../../layouts/default | ||
|
||
block head | ||
title About product | ||
|
||
block body | ||
include includes/header | ||
p Test body: 123 | ||
include ../../../components/slider/slider |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-pug/src/views/pages/about/includes/header.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1 About 123 |
9 changes: 9 additions & 0 deletions
9
test/manual/watch-non-entry-partial-pug/src/views/pages/about/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extends ../../layouts/default | ||
|
||
block head | ||
title About | ||
|
||
block body | ||
include includes/header | ||
p Test body: 123 | ||
include ../../../components/slider/slider |
1 change: 1 addition & 0 deletions
1
test/manual/watch-non-entry-partial-pug/src/views/pages/home/includes/header.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1 Home |
9 changes: 9 additions & 0 deletions
9
test/manual/watch-non-entry-partial-pug/src/views/pages/home/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extends ../../layouts/default | ||
|
||
block head | ||
title Home | ||
|
||
block body | ||
include includes/header | ||
p Test body: 123 | ||
include ../../../components/slider/slider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('html-bundler-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: 'production', | ||
stats: 'minimal', | ||
|
||
output: { | ||
path: path.join(__dirname, 'dist/'), | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
entry: { | ||
index: './src/views/pages/home/index.pug', | ||
about: './src/views/pages/about/index.pug', | ||
}, | ||
preprocessor: 'pug', | ||
hotUpdate: true, | ||
//verbose: true, | ||
}), | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(css)$/, | ||
use: ['css-loader'], | ||
}, | ||
], | ||
}, | ||
|
||
devServer: { | ||
static: { | ||
directory: path.join(__dirname, 'dist'), | ||
}, | ||
watchFiles: { | ||
paths: ['src/**/*.*'], | ||
options: { | ||
usePolling: true, | ||
}, | ||
}, | ||
}, | ||
|
||
watchOptions: { | ||
// fix twice recompilation the same file | ||
aggregateTimeout: 600, | ||
}, | ||
}; |