2

我有一个平均堆栈网站,在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:我想知道:

  1. 有没有办法让 webpack 生成例如, http://localhost:3000/3.bundle.js并且http://localhost:3000/11.bundle.js没有基础/1/

  2. 有没有办法让 AngularJS 或 NodeJS 仍然以http://localhost:3000/1/*.bundle.jslike的形式加载好文件http://localhost:3000/1/3.bundle.js

4

0 回答 0