-
-
Notifications
You must be signed in to change notification settings - Fork 372
Fix multiple copies of preact in production build (fix #126) #133
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
Conversation
|
Travis build failed because we Skip installation of dependencies in tests. I'll look into enabling it & caching. |
|
@rkostrzewski the tests failed in my local machine as well. Can you please have a look at the log? https://paste.fedoraproject.org/paste/~djRyBcRUltRzRRaON3~qg |
|
I wonder if falling back to |
|
not sure how that is gonna fit in. Can you tell me how to get this problem fixed? |
|
I think we just need to provide a path to the dev/module bundle? We can do this at the top of the config... something like: let preact, type = isProd ? 'preact/dist/preact.min' : 'preact';
try {
preact = require.resolve(type);
} catch (err) {
throw err;
}
// ...
preact$: preactAlso, this is because I'm suspecting that Not able to go thru this right now & debug what's happening, else I would! 😄 |
|
Can't we use yarn? It is much faster compared to npm. I know this is just going towards #15 😅 |
|
More like #31 😃 |
|
@rkostrzewski the suggestion by @lukeed works perfectly fine. Though that is more like a hack. If it is fine, I'll make another PR to the same with the patch by @lukeed. I hope that will be fine. |
|
Suggestion - we can use require-relative for this: import requireRelative from 'require-relative';
// attempt to resolve a dependency, giving $CWD/node_modules priority:
function resolveDev(dep, cwd) {
try { return requireRelative.resolve(dep, cwd || process.cwd()); } catch (e) {}
try { return require.resolve(dep); } catch (e) {}
return dep;
}
// ...
aliases: {
preact$: resolveDep(isProd ? 'preact/dist/preact.min' : 'preact', env.cwd),
} |
|
Yeah, we can. Is there a benefit here though? Plus I still have a feeling that |
|
Hmm. If The reason I suggested require-relative is so that if someone installs a specific version of |
|
Yeah, that's what I thought, but was having doubts looking at the travis logs here. I agree. But in a Node 6+ environment, it's flat dep tree, so wouldn't a custom install overwrite what we ship? I'm inclined to think it does, since it's the same name (as opposed to a unique dep), but today also seems to be "just one of those days". 😴 😇 |
|
|
|
when I run |
|
In the travis log, this kinda caught my mind (https://travis-ci.org/developit/preact-cli/jobs/246455525#L1827) any idea why there are two instances of that? |
|
@reznord it's opening Google Chrome because tests use it to verify if the app works correctly 😄. As for the warning with AudioManager - it doesn't matter at all (folks at lighthouse have that warning too). |
|
@rkostrzewski cool. I have updated the PR. Can you please review it? As @developit suggested, I have added the |
rkostrzewski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fix for #126