Inconsistant build behaviour using 'snowpack dev' and 'snowpack build' #758
Replies: 11 comments 5 replies
-
Yes, same experience here with other modules. |
Beta Was this translation helpful? Give feedback.
-
I still have this problem with snowpack 2.7.7 and @snowpack/plugin-run-script 2.0.4" I cannot understand why the build result from 'build' is altered when run in the dev server. |
Beta Was this translation helpful? Give feedback.
-
@MatsSundqvist @jcschmidig There is a workaround which is setting
|
Beta Was this translation helpful? Give feedback.
-
I already have "treeshake=true" $ npx snowpack build snowpack Server starting… ▼ Console [snowpack] ! updating dependencies... |
Beta Was this translation helpful? Give feedback.
-
the problem is the same with 2.8.0 |
Beta Was this translation helpful? Give feedback.
-
I think it must be of high priority that you know that the dev server uses the same js-files that you have in your build directory. Otherwise you don't know if a production deployed application is ok even if it seems to be ok in the dev server. Or in my case - the built application is ok but I can ot run it in the dev server. |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, thanks for surfacing these issues. Some notes/thoughts here:
If you'd like to keep tree-shaking for all package except for this one, you can add "redux-undo" to your top-level "install" array in your config file, and Snowpack will assume the entire package is needed. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer @FredKSchott! I think the issue with geojson is resolved. But I still have the issue with 'redux-undo'. I have tried 'treeshake = false', but it didn't change this. functionality from redux-undo is imported in two ways and different files: file1import { ActionCreators } from 'redux-undo'; export function clean() { ==============================
|
Beta Was this translation helpful? Give feedback.
-
using "install": ["redux-undo"], didn't fix it |
Beta Was this translation helpful? Give feedback.
-
Ah, it looks like We provide the 1 thing that we can do: add a troubleshooting entry to the docs site to explain this solution for anyone who encounters an error like |
Beta Was this translation helpful? Give feedback.
-
The 'namedExports' didn't fix the problem for snowpack 2.8.0. I just got an error. But an upgrade to 2.9.0 and 'namedExports' did solve the problem. I also noticed some other things after upgrade:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When using 'snowpack build' the dependecies are installed to build/web_modules as expected. When running 'snowpack start'. The server seems to use another version of the library which is also installed to node_modules/.cache/snowpack
The cached version is not identical to the web_module version.
diff node_modules/.cache/snowpack/dev/redux-undo.js build/web_modules/redux-undo.js
613a614
This gives the following error when loading a page (not index.html) in the browser
Uncaught SyntaxError: The requested module '/web_modules/redux-undo.js' does not provide an export named 'ActionCreators'
When serving the built application directly through another server it works as it should.
Beta Was this translation helpful? Give feedback.
All reactions