Skip to content

Commit 2a78672

Browse files
committed
feat: check whether target bundle exist and throw error
1 parent 320226c commit 2a78672

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ npm install -S inline-source-webpack-plugin
2323
<div class="container">
2424
<h1>hello world!</h1>
2525
</div>
26-
<!-- 'inline-bundle' attribute tell us embed file that generated by webpack -->
26+
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
2727
<script inline inline-bundle="bundle.js"></script>
2828
</body>
2929
</html>

demo/dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="container">
1111
<h1>hello world!</h1>
1212
</div>
13-
<!-- 'inline-bundle' attribute tell us embed file that generated by webpack -->
13+
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
1414
<script>(window.webpackJsonp=window.webpackJsonp||[]).push([["bundle"],[,function(i,e){console.log("This file is build by webpack.But InlineSourceWebpackPlugin will embed it into html file.")}],[[1,"runtime"]]]);</script>
1515
<script type="text/javascript" src="/inline-source-webpack-plugin/demo/dist/runtime.js"></script><script type="text/javascript" src="/inline-source-webpack-plugin/demo/dist/index.js"></script></body>
1616
</html>

demo/src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="container">
1111
<h1>hello world!</h1>
1212
</div>
13-
<!-- 'inline-bundle' attribute tell us embed file that generated by webpack -->
14-
<script inline inline-bundle="bundle.js"></script>
13+
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
14+
<script inline inline-bundle="bundle.js" inline-bundle-delete></script>
1515
</body>
1616
</html>

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class InlineSourceWebpackPlugin {
2525
break;
2626
}
2727
}
28+
if (!source.content) {
29+
compilation.errors.push(new Error(`[${this.constructor.name}]:no asset match '${bundle}'.`));
30+
}
2831
}
2932
if (source.filepath) {
3033
// watch inline target

0 commit comments

Comments
 (0)