xxxmrg / question-answer Goto Github PK
View Code? Open in Web Editor NEWkeeping question
keeping question
在学习 ICG 的时候参考过月影团长的示例代码,其代码就采用了很巧妙的方式来配置 webpack 最终可以得到一个很适合做 demo 的多页面应用,同时可以做到一次配置,可以自动 watch 并打包新添加到 entry 文件夹下的新代码。
仔细参考了其 webpack.config.js,在实际使用的时候遇到了一个问题,在 html 文件中如果直接采用相对路径来引用 js 文件,那么得到的文件实际上是并没有经过 webpack 处理的,也就是无法 import 所有 npm package,但是却并不会发生 404,会让人觉得文件是正确引入的,因此很难找到问题的源头。
排查了所有配置之后发现一直忽略了 output.publicPath
这个配置字段,一直以为它只与 build 之后的文件配置相关,其真正作用是用来标示打包后的文件的资源引用路径,最重要的,这个路径同样也是 webpack-dev-server 启动后的资源引用路径。 更多关于该配置,参考官方文档
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.