SoftTimur
SoftTimur

Reputation: 5490

Cannot point to the right bundles because of the base

I have a mean-stack website, and in index.html I have <base href="/1/" />.

I am trying to follow this to integrate the ESM version of the Monaco Editor by using plain webpack.

I can successfully generate all the bundle files in dist folder.

Now, in app.js I add app.use(express.static(path.join(__dirname, 'dist'))) and in index.html I add <script src="/app.bundle.js"></script>. As a result, loading the webpage loads well http://localhost:3000/app.bundle.js which points well to the right file.

However, when I load a monaco-editor, it loads e.g., http://localhost:3000/1/3.bundle.js and http://localhost:3000/1/11.bundle.js which cannot point to the right file because of the base /1/.

Does anyone know how to fix this?

PS: I am wondering:

  1. Is there is a way to let webpack generate e.g., http://localhost:3000/3.bundle.js and http://localhost:3000/11.bundle.js without the base /1/?

  2. Is there a way to let AngularJS or NodeJS still load well files in the form of http://localhost:3000/1/*.bundle.js like http://localhost:3000/1/3.bundle.js?

Upvotes: 2

Views: 86

Answers (0)

Related Questions