Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools failed to load SourceMap with nollup only #9

Open
frederikhors opened this issue Oct 1, 2020 · 4 comments
Open

DevTools failed to load SourceMap with nollup only #9

frederikhors opened this issue Oct 1, 2020 · 4 comments

Comments

@frederikhors
Copy link
Contributor

frederikhors commented Oct 1, 2020

I'm trying to use the amazing @urql/svelte.

It works both with nollup and rollup.

But with nollup I have these warnings in console:

image

DevTools failed to load SourceMap: Could not load content for http://localhost:5000/node_modules/@urql/core/dist/2b2328af.mjs.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load SourceMap: Could not load content for http://localhost:5000/node_modules/@urql/svelte/dist/urql-svelte.mjs.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Reproduction here: https://github.com/frederikhors/svelte-template-hot/tree/urql-svelte-sourcemap-warnings

Why?

@frederikhors
Copy link
Contributor Author

Edit: Added reproduction project.

@rixo
Copy link
Owner

rixo commented Oct 5, 2020

I have no real idea how sourcemaps works in Nollup (or generally otherwise...), but you can probably fix this by adding a middleware to serve contents from /node_modules/ if that's important to you.

Add a .nolluprc.js file to your project with something like this:

const path = require('path')
const fs = require('fs')

module.exports = {
  before(app) {
    app.get('/node_modules/*', (req, res, next) => {
      const file = path.resolve(__dirname, req.url.replace(/^\//, ''))
      fs.exists(file, exists => {
        if (exists)res.sendFile(file)
        else next()
      })
    })
  }
}

@frederikhors
Copy link
Contributor Author

Wow it works!

But I have totally no idea what I'm doing.

Does it impact performance in your opinion?

Can it affect the final bundle created with npm run build?

@rixo
Copy link
Owner

rixo commented Oct 6, 2020

I was surely tired previously, it's obviously not a sourcemap problem. It's a more of a dev server problem.

No it wouldn't impact performance in any meaningful way... Like we're speaking less than a ms or so per request. And it wouldn't end up in prod build. Nollup doesn't do prod build. It doesn't do build at all actually. It just does fast dev server mostly compatible with Rollup config. It is intended that you produce your prod bundle with Rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants