webpack - 由于基础,无法指向正确的捆绑包
问题描述
我有一个平均堆栈网站,在index.html
我有<base href="/1/" />
.
我正在尝试通过使用普通webpack来集成摩纳哥编辑器的 ESM 版本。
我可以成功生成文件夹中的所有捆绑文件dist
。
现在,在app.js
我添加app.use(express.static(path.join(__dirname, 'dist')))
和在index.html
我添加<script src="/app.bundle.js"></script>
. 结果,加载网页加载良好http://localhost:3000/app.bundle.js
,指向正确的文件。
但是,当我加载 monaco-editor 时,它会加载例如, http://localhost:3000/1/3.bundle.js
并且http://localhost:3000/1/11.bundle.js
由于 base 无法指向正确的文件/1/
。
有谁知道如何解决这一问题?
PS:我想知道:
有没有办法让 webpack 生成例如,
http://localhost:3000/3.bundle.js
并且http://localhost:3000/11.bundle.js
没有基础/1/
?有没有办法让 AngularJS 或 NodeJS 仍然以
http://localhost:3000/1/*.bundle.js
like的形式加载好文件http://localhost:3000/1/3.bundle.js
?
解决方案
推荐阅读
- flutter - 如何使用 GetConnect 修复 api refreshToken 调用多次
- c# - getfiles 中是否有特定扩展名的搜索模式(多个)?
- flutter - 在 iOS 15 beta 上使用 canvaskit 进行 Flutter web
- reactjs - 在我的 App 组件中导入 i18n 后,组件消失了
- android - Why i see Lost device connection message when open gallery using image_picker?
- c++ - Make valgrind to collect the data on request
- amazon-web-services - EMR stuck at bootstrap script
- javascript - 为什么我的所有首字母大写的函数在与最终结果比较时返回 false?Javascript
- matplotlib - i am receiving an error when trying to install plotly in jupyter notebook
- android - How to pass the correct coroutine scope in unit test when testing viewmodel