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
Add HMR support for linked & local npm packages #470
Conversation
@@ -198,7 +198,7 @@ function resolveWebDependency(dep: string, isExplicit: boolean): DependencyLoc { | |||
} | |||
return { | |||
type: 'JS', | |||
loc: path.join(depManifestLoc, '..', foundEntrypoint), | |||
loc: path.join(depManifestLoc || '', '..', foundEntrypoint), |
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.
These changes were because of the return type addition.
5120b88
to
bec4c02
Compare
cwd: '/', // we’re using absolute paths, so watch from root | ||
persistent: true, | ||
ignoreInitial: true, | ||
disableGlobbing: false, |
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.
Ended up not needing the followSymlinks: true
here! Because we’re not watching the symlink dirs 😛
b959efc
to
c353f51
Compare
@@ -214,6 +223,28 @@ export async function command(commandOptions: CommandOptions) { | |||
// no import-map found, safe to ignore | |||
} | |||
|
|||
/** Rerun `snowpack install` while dev server is running */ |
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.
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.
Nice! I'd like to start doing the same
f53d6bc
to
b21a131
Compare
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 with some small comments (since we paired on some of this, not too much new code to review).
@@ -214,6 +223,28 @@ export async function command(commandOptions: CommandOptions) { | |||
// no import-map found, safe to ignore | |||
} | |||
|
|||
/** Rerun `snowpack install` while dev server is running */ |
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.
Nice! I'd like to start doing the same
Quick question about this change: will it have any impact on https://www.pika.dev/npm/snowpack/discuss/286 , or could it be extended to support that use case? Those packages are also local and liable to change, but they aren't sourced via |
b21a131
to
bdbb71c
Compare
bdbb71c
to
04c9082
Compare
@airhorns Thanks for raising that discussion! I think yeah that may be another PR to add Yarn workspaces. I haven’t used it much but as you pointed out I think it’s just different enough from Also whereas this PR only touches |
From #429, Adds basic HMR support for linked & local npm packages. As seen here:
The basic process is this:
snowpack dev
file:…
). It knows because some metadata is missing when it’s not downloaded from npm.In the future, this could possibly be extended to support all first-class dependencies in node_modules, but for now it’s limited to linked & local packages (i.e. local to your filedisk, not downloaded).