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

Request to remove CSS source maps from the dist #682

Open
ofk opened this issue Dec 9, 2024 · 0 comments
Open

Request to remove CSS source maps from the dist #682

ofk opened this issue Dec 9, 2024 · 0 comments

Comments

@ofk
Copy link

ofk commented Dec 9, 2024

Currently, the build outputs include styles.css.map and styles.layer.css.map. I would like to request that these files be excluded, similar to how it's handled in mantine-contextmenu and @mantine/core.

How to fix

You can modify the postcss.config.js file to be the same as in mantine-contextmenu. Specifically, you remove the map option to ensure that .css.map files are not included in the dist directory.

Reason

When bulk loading mantine CSS in a react-router framework, using the following imports:

@import '@mantine/core/styles.layer.css';
@import 'mantine-datatable/styles.layer.css';

@layer mantine, mantine-datatable;

The sourceMappingURL comment from mantine-datatable are retained, but source map file is not copied. As a result, when I open the developer console and access the page, the react-router server logs an error as follows:

Error: No route matches URL "/app/app.css.map"
    at getInternalRouterError (/myproj/node_modules/react-router/dist/development/index.js:3908:5)
    at Object.query (/myproj/node_modules/react-router/dist/development/index.js:2744:19)
    at handleDocumentRequest (/myproj/node_modules/react-router/dist/development/index.js:9300:35)
    at requestHandler (/myproj/node_modules/react-router/dist/development/index.js:9217:24)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at nodeHandler (/myproj/node_modules/@react-router/dev/dist/vite.js:1969:30)
    at /myproj/node_modules/@react-router/dev/dist/vite.js:1975:17

This error occurs when files with sourceMappingURL comments are imported. If the comments are removed from mantine-datatable, this issue will be resolved.

Is this a problem within other libraries?

You are correct.

However, I have not been able to pinpoint the root cause of this issue. It appears that there might be a problem with the postcss configuration of mantine and the configuration of react-router, but I am not sure which project this issue should be reported to and resolved by.

On the other hand, a quick resolution to this problem is suggested by this issue. I would appreciate it if this fix could be implemented.

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

1 participant