-
Notifications
You must be signed in to change notification settings - Fork 81
SSR moduleIds not flushing #3
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
Comments
ur doing externals correctly: ...um im not sure. |
are you sure it's not "blacklist". i dont use that package. ...but the goal is to make sure the given 3 packages are not assumed to exist externally. i.e. webpack has to handle them. |
to test whether the externals stuff has to do with the problem, remove it and dont use externals. if it works, then something is wrong there. if not, move to next possible problem area. |
... |
Yeah, they are included. Was working with https://github.com/liady/webpack-node-externals#optionswhitelist:
Also, tried without |
|
my guess it has to do with how you're making the moduleIds deterministic. |
but if ur not getting moduleIds from flushModuleIds(), then perhaps it has nothing to do with webpack-flush-chunks and deterministic module IDs. ..i saw u were logging this. if ur not getting anything, that means it's an issue react-universal-component, or probably require-universal-module. Log the transpiled code within node_modules corresponding to this line in require-universal-modules: export const flushModuleIds = (): Ids => {
const ids = Array.from(MODULE_IDS)
MODULE_IDS.clear()
return ids
} as well as this function: const addModule = (): void => {
if (isServer) {
if (chunkName) {
CHUNK_NAMES.add(chunkName)
}
// just fill both sets so `flushModuleIds` continues to work,
// even if you decided to start providing chunk names. It's
// a small array of 3-20 chunk names on average anyway. Users
// can flush/clear both sets if they feel they need to.
if (isWebpack() && weakId) {
MODULE_IDS.add(weakId)
}
else if (!isWebpack() && path) {
MODULE_IDS.add(path)
}
}
} ...if ur doing all this correctly, something is wrong with webpack stats and how ur getting it. |
What do you mean by "my guess it has to do with how you're making the moduleIds deterministic"? Using a regex name match for const nodeModules = nodeExternals({
whitelist: [
/^react-universal-component/,
/^require-universal-module/,
/^webpack-flush-chunks/,
],
}); |
Also, thanks for catching the double |
so that module names aren't full file paths, exposing ur file system. instead it's a has hashes which obscures ur filesystem. |
deterministic means the same on both the client. usually module IDs are incrementing numbers, and the numbers end up different in the client vs. server bundle. thats why u gotta make them deterministic with one of those 2 plugins. |
for webpack flush chunks to work, what is initially flushed is the server side module IDs. then it searches through your client webpack stats using those module IDs to find the corresponding chunks. However if your client bundle had different module IDs, it would not work. |
Thanks for all of your help! I was wondering why'd you'd use |
I am sure I am missing something small here. I tried moving over from
react-loadable
, but am unable to get the server'smoduleIds
to flush correctly.Any ideas?
react-universal-starter/tree/feature/extract-css-chunks-webpack-plugin
The text was updated successfully, but these errors were encountered: