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

Source maps seem broken #1191

Open
matthias-ccri opened this issue Aug 18, 2023 · 4 comments
Open

Source maps seem broken #1191

matthias-ccri opened this issue Aug 18, 2023 · 4 comments

Comments

@matthias-ccri
Copy link
Contributor

matthias-ccri commented Aug 18, 2023

I'm seeing warnings from webpack in my browser console:

[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/error.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/error.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/struct.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/struct.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/structs/coercions.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/structs/coercions.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/structs/refinements.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/structs/refinements.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/structs/types.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/structs/types.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/structs/utilities.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/structs/utilities.ts'
[webpack-dev-server] WARNING in ../../node_modules/superstruct/dist/index.mjs
Module Warning (from ../../node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/user/src/project/node_modules/superstruct/src/utils.ts' file: Error: ENOENT: no such file or directory, open '/home/user/src/project/node_modules/superstruct/src/utils.ts'

The index.mjs file has //# sourceMappingURL=index.mjs.map at the bottom which looks fine, however...

Here are the contents of index.mjs.map:

{"version":3,"file":"index.mjs","sources":["../src/error.ts","../src/utils.ts","../src/struct.ts","../src/structs/utilities.ts","../src/structs/types.ts","../src/structs/coercions.ts","../src/structs/refinements.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":"AAAA;;AAEG;AAaH;;;;;;;AAOG;AAEG,MAAO,WAAY,SAAQ,SAAS,CAAA;IAUxC,WAAY,CAAA,OAAgB,EAAE,QAAkC,EAAA;AAC9D,QAAA,IAAI,MAAkC,CAAA;QACtC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;AACjD,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;QACxB,MAAM,GAAG,GACP,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,CAAA,SAAA,EAAY,IAAI,...

These reference paths like ../src/error.ts, but there is no src folder in the package as of v1.0.3, which seems to cause the warnings.

@dimitrisnl
Copy link

This is a huge blocker, unsure how its not a problem for more

@shellscape
Copy link

@dimitrisnl this issue is more about the warnings being produced, this isn't a blocker for functionality. those warnings shouldn't prevent anything from running correctly. (I'm not sure why they're being produced but just elaborating)

@matthias-ccri
Copy link
Contributor Author

I found a workaround: Add this to the webpack config:

        ignoreWarnings: [
            /Failed to parse source map/,
        ],

@Robin40
Copy link

Robin40 commented Feb 29, 2024

For me it didn't let me analyze the bundle using source-map-explorer on a build generated by Vite.

My workaround for that is to do npx source-map-explorer ./dist/assets/*.js --no-border-checks.

The --no-border-checks lets me analyze the bundle again, but superstruct will appear as a black box (for me it doesn't matter).

The functionality of superstruct itself has NOT been blocked by the warnings whatsoever, I can just ignore them.

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

4 participants