question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for dynamic webpack public paths

See original GitHub issue

According to the webpack docs, you can configure a dynamic public path for output files (like the web worker file) at runtime by adding __webpack_public_path__ = myRuntimePublicPath; to the top of your entry. However, this plugin generates a one-line entry e.exports = __webpack_public_path__ + "rustworker.worker.js".

It would be great if there were some configuration option for this plugin to allow adding the runtime public path override line to the generated entry.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

2reactions
skmvasucommented, Feb 28, 2020

@developit I’m also facing a similar problem. I’m publishing a library which internally uses a Sharedworker. When bundling this, the sdk.js, and my worker.js are generated.

The problem is when the client imports sdk.js, it’s part of it’s vendor bundle. However worker file is not on the clients public path.

This is the code that gets generated by the plugin:

    './node_modules/worker-plugin-shared/dist/loader.js?{"name":"0"}!./src/sdk/socket/worker.ts': function(
      e,
      t,
      n,
    ) {
      e.exports = n.p + 'js/0.70afebd5.worker.js';
    },

The generated worker file is not available in the publicPath of the client. Not sure how this can be handled. @developit any thoughts on how to handle this?

1reaction
skmvasucommented, Mar 12, 2020

Makes sense. Thanks for taking a look 😃

We’re exploring a few options. Will update if something works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack-dynamic-public-path - npm
Start using webpack-dynamic-public-path in your project by running `npm i webpack-dynamic-public-path`. There are 8 other projects in the ...
Read more >
Is it possible to have `publicPath` configured dynamically in ...
The solution is to define __webpack_public_path__ at runtime when making a production build. But be careful not to use it in development as...
Read more >
Public Path - webpack
It allows you to specify the base path for all the assets within your application. Use Cases. There are a few use cases...
Read more >
Change Webpack's publicPath on the fly - Medium
Setting up webpack's publicPath in ES6 modules ... most frustrating part was to correctly set up the dynamic path as I ... Let...
Read more >
dynamic-public-path-webpack-plugin - npm package - Snyk
Allows you to use a global, client side variable to set publicPath instead of the string arbitrarily set in options.publicPath. Very useful when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found