Shopify / theme-tools

Everything developer experience for Shopify themes
https://shopify.dev/docs/themes
MIT License
80 stars 24 forks source link

@shopify/liquid-html-parser package has no `.js.map` files #535

Open pashakbit opened 1 month ago

pashakbit commented 1 month ago

Describe the bug @shopify/liquid-html-parser package has no /src folder and .js.map files. We can check that on npmjs.com (linked to package name above). This package is used in @shopify/theme-check-common package that is needed for .liquid files checking. Naturally, missing .js.map files results in errors if you have source mapping for dependencies in your project. Errors like that:

WARNING in ./node_modules/@shopify/liquid-html-parser/dist/conditional-comment.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'X:\work\shop\shops\node_modules\@shopify\liquid-html-parser\dist\conditional-comment.js.map' file:
Error: ENOENT: no such file or directory, open 'X:\work\shop\shops\node_modules\@shopify\liquid-html-parser\dist\conditional-comment.js.map'

Expected behaviour @shopify/liquid-html-parser package has /src folder and .js.map files and has no source map loading errors.

Actual behaviour @shopify/liquid-html-parser package has no /src folder and .js.map files. But tries to use sourceMappingURLs in the every .js files like in the screenshot: Image

Debugging information

charlespwd commented 4 weeks ago

I thought that source maps in node_modules are generally disabled when you're setting them up 🤔 Might be that we should upload them to npm without 'em.

pashakbit commented 4 weeks ago

I thought that source maps in node_modules are generally disabled when you're setting them up

Unfortunatly, if we use react-scripts (as for project that I work) we need to use remount to configurate inner webpack config and to add special logic to avoid files with sourceMappingUrl line but when this files is not exist.

Might be that we should upload them to npm without 'em.

You have implementation with source mapping in the most part of other libs like in @shopify/theme-check-common. But if it is more easy for you to remove this sourceMappingUrl lines from your files I will be glad this solution too.