[英]How can I demonstrate use of a webpack bundle?
Background: I have a web page. 背景:我有一个网页。 I'm trying to use webpack.
我正在尝试使用webpack。 I altered my package.json, built a webpack.config.js, issued a CLI webpack compile command, and got new file with the right name (*.bundle.js) in the directory I specified.
我更改了package.json,构建了webpack.config.js,发出了CLI webpack编译命令,并在指定的目录中获得了名称正确的新文件(* .bundle.js)。 That file is impressively smaller than the group of files it should replace.
该文件比应替换的文件组小得多。
How do I use that file? 如何使用该文件?
When I point a browser to it, expect to get my web page, but the browser shows me the JavaScript webpack wrote. 当我将浏览器指向它时,期望得到我的网页,但是浏览器显示了JavaScript webpack编写的内容。
Following the instructions at http://webpack.github.io/docs/tutorials/getting-started/ , I would point the browser to the original files. 按照http://webpack.github.io/docs/tutorials/getting-started/上的说明,我将浏览器指向原始文件。 Sure!
当然! They display the web site, but does webpack?
他们显示网站,但是webpack吗? (I presume it does, but I don't to how to do it.)
(我想是可以的,但是我不怎么做。)
EDIT: The above paragraph demonstrates that I missed an important point in the page cited. 编辑:上面的段落说明我错过了引用页面中的重要点。 I couldn't find how to use strikeout text;
我找不到如何使用删除线文本; I used italics.
我用斜体。 See Quentin's answer.
参见昆汀的答案。
Thanks in advance ... 提前致谢 ...
Webpage bundles all the JavaScript files up into a single JavaScript file and replaces the require
calls. 网页将所有JavaScript文件捆绑为一个JavaScript文件,并替换了
require
调用。
It is still a JavaScript file. 它仍然是一个JavaScript文件。
You don't point the browser at a JavaScript file. 您无需将浏览器指向JavaScript文件。 You point the browser at an HTML document with a
<script src="/path/to/the/packed.bundle.js"></script>
element in it. 您将浏览器指向带有
<script src="/path/to/the/packed.bundle.js"></script>
元素的HTML文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.