Sourcemaps not being served by snowpack dev #1103
-
I'm running {
"mount": {
"src": "/"
},
"plugins": [],
"installOptions": { "sourceMap": true },
"devOptions": { "port": 8000 }
} however I'm getting warnings for a lot of the npm packages I'm importing saying that not souremap was found. e.g.: With this config, I was expecting sourcemaps to be created, but it seems they aren't? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 9 replies
-
I tried running |
Beta Was this translation helpful? Give feedback.
-
Can you share what the warnings that you are seeing look like? |
Beta Was this translation helpful? Give feedback.
-
Hmm, so it sounds like it's getting the wrong thing served at that URL. Can
you share an example of what the response looks like for one of those URLs?
My guess is that it's not actually JSON..
…On Mon, Sep 21, 2020 at 12:23 PM maxwell8888 ***@***.***> wrote:
Ah so it is actually serving the maps, for example for
http://localhost:8000/web_modules/lit-html.js.map it is serving:
export { o as AttributeCommitter, A as AttributePart, B as BooleanAttributePart, D as DefaultTemplateProcessor, E as EventPart, N as NodePart, u as PropertyCommitter, P as PropertyPart, S as SVGTemplateResult, T as Template, a as TemplateInstance, c as TemplateResult, v as createMarker, g as defaultTemplateProcessor, d as directive, h as html, j as isDirective, q as isIterable, f as isPrimitive, i as isTemplatePartActive, n as noChange, l as nothing, p as parts, b as removeNodes, r as render, k as reparentNodes, s as svg, t as templateCaches, e as templateFactory } from './common/lit-html-4b9e08e9.js';//# sourceMappingURL=lit-html.js.map
and the errors are:
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/lit-html.js.map: Unexpected token e in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/lit-html/directives/until.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/lit-html-4b9e08e9.js.map: Unexpected token / in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/tslib.es6-58b4a7ae.js.map: Unexpected token / in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-button.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/lit-element.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/date-fns.js.map: Unexpected token u in JSON at position 1
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/events-a64aa528.js.map: Unexpected token / in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/foundation-5da43da3.js.map: Unexpected token / in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/lit-html/directives/class-map.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/ripple-directive-418af5da.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/observer-8c5412ba.js.map: Unexpected token c in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-dialog.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/base-element-86236253.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/common/if-defined-b5c2df23.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-list/mwc-list.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-textfield.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-list/mwc-list-item.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for ***@***.***/mwc-icon-button.js.map: Unexpected token i in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/web_modules/lit-html/directives/unsafe-html.js.map: Unexpected token i in JSON at position 0
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1103 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEX5EZ2EDS44HHSOKJT4DDSG6R37ANCNFSM4RU4GTWQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Same problem here with snowpack 2.11.1. Dev server is serving the js file in lieu of the actual source map. |
Beta Was this translation helpful? Give feedback.
-
Thanks again everyone for surfacing this. just found the issue and pushed a quick fix here: bcc1fbc This just missed the v2.12.1 release but will make it in in the next release. |
Beta Was this translation helpful? Give feedback.
-
I just started using snowpack and ran into this exact same issue. When chrome tries to resovle the source map url, it get served the actual file rather than the map. Using snowpack v2.18.5 Example source map url: Chrome error,
Actual file served by snowpack at the map url,
My config is // Snowpack Configuration File
// See all supported options: https://www.snowpack.dev/#configuration
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
src: "/dist",
public: "/",
},
plugins: ["@snowpack/plugin-babel", "@snowpack/plugin-react-refresh"],
install: [
"react/jsx-runtime",
"@emotion/styled/base",
"core-js/modules/es.array.is-array.js",
],
installOptions: {
sourceMap: true,
},
buildOptions: {
sourceMaps: true,
},
devOptions: {
open: "none",
},
}; Any suggestions on how to fix this? |
Beta Was this translation helpful? Give feedback.
Thanks again everyone for surfacing this. just found the issue and pushed a quick fix here: bcc1fbc
This just missed the v2.12.1 release but will make it in in the next release.