-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Can't resolve '../node_modules/maplibre-gl/dist/maplibre-gl.css' #7145
Comments
@birkskyum Would you please have a look at this? |
@sunshinesmilelk Would you please explain how you loaded plotly.js? |
When attempting to upgrade from 2.35.0 to 2.35.1, I also experience this issue.
|
For what it's worth, my project is using 1 major version older for css-loader(6.*) and style-loader(3.*) compared to Plot.ly. No clue if that has something to do with it. |
@coffe4u , what package manager do you use, and do you have a workspace/monorepo setup? |
I use |
My "node_modules" directory is in the root of the project. Nothing special about the set up. |
@coffe4u , @sunshinesmilelk , could you try to import plotly as "import Plotly from 'plotly.js/dist/plotly.min.js'; ? |
This would be addressed in the upcoming |
I can confirm now that these work: import Plotly from "plotly.js/dist/plotly.min.js"; .. in the SolidStart project i tested, the I see this - could explain why it's hanging: VITE v5.4.3 ready in 182 ms
➜ Local: http://localhost:3001/
➜ Network: use --host to expose
➜ press h + enter to show help
✘ [ERROR] Could not resolve "buffer/"
node_modules/plotly.js/src/traces/image/helpers.js:5:21:
5 │ var Buffer = require('buffer/').Buffer; // note: the trailing slash is important!
╵ ~~~~~~~~~
You can mark the path "buffer/" as external to exclude it from the bundle, which will remove this
error and leave the unresolved path in the bundle. You can also surround this "require" call with
a try/catch block to handle this failure at run-time instead of bundle-time.
12:45:35 AM [vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/plotly.js/src/traces/image/helpers.js:5:21: ERROR: Could not resolve "buffer/" |
I managed now to also run with import commonjs from 'vite-plugin-commonjs';
export default defineConfig({
define: {
global: {}, // <-- it complained about global not being defined
},
plugins: [
commonjs(), // <-- allow `import from` to act like a require()
]
}) So, basically, this .css ticket is resolved, and it's a separate issue which is that plotly is a cjs-only build, and many environments are esm by default, but it's quite easy to config if it's clear what the situation is. It's not a new thing, so shouldn't affect existing users upgrading. |
@birkskyum thanks for the quick fix on this! I just tested 2.35.2 and it worked as expected for me. |
When I use the latest version of plotly.js 2.35.1, the following error occurs, but there was no such error with the previous version.
![iShot_2024-09-10_22 27 26](https://private-user-images.githubusercontent.com/41573506/366083715-8cad6ec0-05b0-441d-b484-8a03d7b057b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NjgyNTAsIm5iZiI6MTczOTY2Nzk1MCwicGF0aCI6Ii80MTU3MzUwNi8zNjYwODM3MTUtOGNhZDZlYzAtMDViMC00NDFkLWI0ODQtOGEwM2Q3YjA1N2IzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDAxMDU1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc2YmEyMTMzNzE5N2Q3YWI4MDlhMDA3ZWJiYTQ3ZjljYTBlNjFlYjU4N2ZlMDQ1MzE2ZjhhYzA3ODIxZjU3ZjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Mo_XgnOFkLXj3NfnMeBpSada2mcZLMZLWlTJ0CJXAXE)
The text was updated successfully, but these errors were encountered: