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

Failed to parse source map from #481

Closed
vaynevayne opened this issue Oct 10, 2024 · 5 comments · Fixed by #483
Closed

Failed to parse source map from #481

vaynevayne opened this issue Oct 10, 2024 · 5 comments · Fixed by #483
Labels
bug Something isn't working context-v2 Related to tailwind-merge v2

Comments

@vaynevayne
Copy link

happened when build in jenkins

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

Failed to parse source map from '/xxx/node_modules/.pnpm/[email protected]/node_modules/src/lib/class-group-utils.ts' file: Error: ENOENT: no such file or directory, open '/xxx/node_modules/.pnpm/[email protected]/node_modules/src/lib/class-group-utils.ts'

Failed to parse source map from '/xxx/node_modules/.pnpm/[email protected]/node_modules/src/lib/config-utils.ts' file: Error: ENOENT: no such file or directory, open '/xxx/node_modules/.pnpm/[email protected]/node_modules/src/lib/config-utils.ts'
@github-actions github-actions bot added the context-v2 Related to tailwind-merge v2 label Oct 10, 2024
@alphaBiota
Copy link

alphaBiota commented Oct 11, 2024

I have had these warnings start now when running in dev mode with craco start

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/tailwind-merge/dist/bundle-mjs.mjs
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/class-group-utils.ts' file: Error: ENOENT: no such file or directory, open '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/class-group-utils.ts'

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/tailwind-merge/dist/bundle-mjs.mjs
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/config-utils.ts' file: Error: ENOENT: no such file or directory, open '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/config-utils.ts'

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/tailwind-merge/dist/bundle-mjs.mjs
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/create-tailwind-merge.ts' file: Error: ENOENT: no such file or directory, open '<project_path>/node_modules/.pnpm/[email protected]/node_modules/src/lib/create-tailwind-merge.ts'

...

Adding this to craco.config.js has silenced the warnings for me:

      webpackConfig.ignoreWarnings = [
        {
          module: /tailwind-merge/,
          message: /Failed to parse source map/,
        },
      ];

@sabercoy
Copy link

I have this same sort of issue in a mono-repo setup. The sub-package is trying to link to a source in the root node_modules like so:
"../../../../../../node_modules/src/lib/class-group-utils.ts"
but it is missing "tailwind-merge":
"../../../../../../node_modules/tailwind-merge/src/lib/class-group-utils.ts"

@vaynevayne
Copy link
Author

I solved this problem by modifying the webpach configuration.
Is the problem because tailwind-merge does not give a.map file?

 module: {
      strictExportPresence: true,
      rules: [
        // Handle node_modules packages that contain sourcemaps
        shouldUseSourceMap && {
          enforce: 'pre',
          exclude: [/@babel(?:\/|\\{1,2})runtime/, /node_modules/], //  modify here , add /node_modules/
          test: /\.(js|mjs|jsx|ts|tsx|css)$/,
          loader: require.resolve('source-map-loader'),
        },

@dcastil dcastil added the bug Something isn't working label Oct 14, 2024
@dcastil
Copy link
Owner

dcastil commented Oct 14, 2024

Hey @vaynevayne and everyone else! 👋

Just checked [email protected] and there the source maps indeed seem to be linking incorrectly.

E.g. in the file tailwind-merge/dist/bundle-mjs.mjs.map I see paths like ../../src/lib/class-group-utils.ts, but that's one directory too far up, it should be ../src/lib/class-group-utils.ts. This was still correct in v2.5.2.

I'll fix this.

Copy link

This was addressed in release v2.5.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working context-v2 Related to tailwind-merge v2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants