Skip to content

Commit

Permalink
fix: add the root dir of the module to exports in the package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
webdiscus committed Nov 8, 2023
1 parent 4bbd285 commit 54a43d5
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 66 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change log

## 3.0.0 (2023-10-29)
## 3.0.1 (2023-11-08)

- fix: add the root dir of the module to exports in the package.json
- test: update manual tests for using with the Eta version 3.x
- docs: update readme for live reloading

## 3.0.0 (2023-11-07)

- feat(BREAKING CHANGE): changed `postprocess` callback arguments and return\
OLD:
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ module.exports = {
},
}),
// your plugin
new MyBundlerPlugin({ enable: true });
new MyBundlerPlugin({ enabled: true });
],
};
```
Expand Down Expand Up @@ -2535,10 +2535,12 @@ Use this options only if you don't have a referenced source file of a script in
> **Note**
>
> The `devServer.hot` must be true.
> The `devServer.hot` must be `true`.
If you already have a js file in html, this setting should be `false` as Webpack automatically injects the hot update code into the compiled js file.
Also see [Setup Live Reload](#setup-live-reload).
<a id="option-verbose" name="option-verbose"></a>
### `verbose`
Expand Down Expand Up @@ -3950,6 +3952,13 @@ module.exports = {
};
```

> **Warning**
>
> If you don't have a referenced source script file in HTML, then set the [hotUpdate](#option-hot-update) option to `true` to enable live reload.
> Besides, the `devServer.hot` must be `true` (defaults).
>
---
#### [↑ back to contents](#contents)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-bundler-webpack-plugin",
"version": "3.0.0",
"version": "3.0.1",
"description": "HTML bundler plugin for webpack handles a template as an entry point, extracts CSS and JS from their sources referenced in HTML, supports template engines like Eta, EJS, Handlebars, Nunjucks.",
"keywords": [
"html",
Expand Down Expand Up @@ -66,6 +66,7 @@
"types.d.ts"
],
"exports": {
".": "./src/index.js",
"./plugins": "./plugins/index.js",
"./plugins/favicons-bundler-plugin": {
"types": "./plugins/favicons-bundler-plugin/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions test/manual/preprocessor-default/src/views/home.eta
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<script src="./main.js"></script>
</head>
<body>
<%~ includeFile('/src/views/partials/header') %>
<%~ include('/src/views/partials/header') %>
<h1><%= headline %></h1>
<ul class="people">
<% for (let i = 0; i < people.length; i++) {%>
<li><%= people[i] %>></li>
<% } %>
</ul>
<img src="../images/apple.png" alt="apple" />
<%~ includeFile('/src/views/partials/footer') %>
<%~ include('/src/views/partials/footer') %>
</body>
</html>
48 changes: 28 additions & 20 deletions test/manual/watch-dependencies-bootstrap/src/views/home.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Test</title>
<link rel="icon" href="apple.png">
<link href="bootstrap" rel="stylesheet">
<link href="./style.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" defer="defer"></script>
<script src="bootstrap" defer="defer"></script>
<script src="./main.js" defer="defer"></script>
</head>
<body>
<%~ includeFile('/src/views/partials/header') %>
<h1>Hello World!</h1>
<img src="apple.png">
<p><button type="button" class="btn-modal btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Open modal</button></p>
<%~ includeFile('/src/views/partials/footer') %>
<%~ includeFile('/src/views/partials/modal.html') %>
<head>
<title>Test</title>
<link rel="icon" href="apple.png" />
<link href="bootstrap" rel="stylesheet" />
<link href="./style.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.12.4.min.js" defer="defer"></script>
<script src="bootstrap" defer="defer"></script>
<script src="./main.js" defer="defer"></script>
</head>
<body>
<%~ include('/src/views/partials/header') %>
<h1>Hello World!</h1>
<img src="apple.png" />
<p>
<button
type="button"
class="btn-modal btn btn-primary"
data-toggle="modal"
data-target="#exampleModal"
data-whatever="@mdo">
Open modal
</button>
</p>
<%~ include('/src/views/partials/footer') %> <%~ include('/src/views/partials/modal.html') %>

<script src="./app.js"></script>
<script src="@test-fixtures/js"></script>
</body>
<script src="./app.js"></script>
<script src="@test-fixtures/js"></script>
</body>
</html>
14 changes: 0 additions & 14 deletions test/manual/watch-dependencies/src/views/home.html

This file was deleted.

14 changes: 14 additions & 0 deletions test/manual/watch-dependencies/src/views/pages/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<link rel="icon" href="apple.png" />
<title><%= title %></title>
<script src="./main.js"></script>
</head>
<body>
<%~ include('/src/views/partials/header') %>
<h1>Hello World!</h1>
<img src="apple.png" />
<%~ include('/src/views/partials/footer') %>
</body>
</html>
37 changes: 23 additions & 14 deletions test/manual/watch-dependencies/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ module.exports = {

plugins: [
new HtmlBundlerPlugin({
entry: {
index: {
import: './src/views/home.html',
data: {
title: 'Home',
},
},
},
// configure paths to watch file changes
watchFiles: {
paths: ['./src'],
//files: [/\.(html|js|sc?ss)$/],
//ignore: [],
},
// auto processing templates in the path
entry: './src/views/pages/',

// define templates manual
// entry: {
// index: {
// import: './src/views/pages/home.html',
// // the template data
// data: {
// title: 'Home',
// },
// },
// },

// test: configure paths to watch file changes
// watchFiles: {
// paths: ['./src'],
// //files: [/\.(html|js|sc?ss)$/],
// //ignore: [],
// },

data: { title: 'Home' }, // global data for all templates
hotUpdate: true, // <= use it only if your html don't have a js file
verbose: true,
}),
],
Expand Down
20 changes: 10 additions & 10 deletions test/manual/watch-html-without-js/src/views/home.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<link rel="icon" href="favicon.ico">
<title>Home</title>
</head>
<body>
<%~ includeFile('/src/views/partials/header') %>
<h1>Home</h1>
<%~ includeFile('/src/views/partials/footer') %>
</body>
<head>
<link rel="icon" href="favicon.ico" />
<title>Home</title>
</head>
<body>
<%~ include('/src/views/partials/header') %>
<h1>Home</h1>
<%~ include('/src/views/partials/footer') %>
</body>
</html>

0 comments on commit 54a43d5

Please sign in to comment.