Skip to content
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

Simplify. cleanup, enhance snowpack internals #2707

Merged
merged 40 commits into from Mar 9, 2021
Merged

Simplify. cleanup, enhance snowpack internals #2707

merged 40 commits into from Mar 9, 2021

Conversation

FredKSchott
Copy link
Owner

@FredKSchott FredKSchott commented Feb 22, 2021

Changes

  • snowpack dev - 500 lines of code refactored away, old branching code paths now unified into a single pipeline.
  • snowpack build - ~350 lines of code refactored away, including a full rewrite of the build pipeline to reuse the dev server internally for file builds.
  • NEW: npm packages are now built using the Snowpack build pipeline - no special rollup plugins needed to build non-JS dependencies. The isPackage flag had been added to the plugin load() hook so that plugins can customize their behavior.
  • NEW: Svelte package SSR support - Svelte packages can ship ".svelte" files in their package distribution, which means that packages are expected to build differently in SSR vs. non-SSR mode. Snowpack now supports this.
  • NEW: Individual package builds - building on our work in esinstall, each npm package is now built & served individually during development. This means that a change to a package (ex: on npm/yarn update) no longer forces the rebuild of your entire dependency tree. This results in a slower first start, but then almost zero cold starts / rebuilds in the future.
  • (As a part of this work, we experimented with esbuild for package installation. Unfortunately, we found that esbuild support is not yet up to par with all of the features of esinstall and failed to build trickier packages. We'll keep an eye on this for a future, possibly v4.0 release. Now that we build packages individually, we can also experiment with passing most packages through esbuild & leaving esinstall around for legacy, trickier packages.)
  • NEW: Improved workspace/linked package support. We now treat npm linked packages as source files by default, giving workspaces instant rebuilds and full HMR support, out of the box.
  • NEW: Improved output defaults for build & programatic usage (no browser open by default, streaming logs instead of default, etc)

Issues resolved

Testing

  • Tests updated and added.

Docs

  • No docs updates needed. Interface is essentially identical. The release notes will just need some tips in case anyone gets stuck upgrading.

@vercel
Copy link

vercel bot commented Feb 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/GoQNJ6Svi24aXAV2AoxFYrWYF6WD
✅ Preview: https://snowpack-git-wip-new-pkg-pikapkg.vercel.app

@joehenry087
Copy link
Contributor

Found a strange error while testing this:

Build Result Error: There was a problem with a file build result.
⠧ watching for file changes...node:internal/process/promises:227
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error: /Users/megatron/FitCrunch/codebase/snowpack-test/src/Sub.svelte - Requested content ".css" but built .js.
    at FileBuilder.verifyRequestFromBuild (/Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:111616:19)
    at FileBuilder.getResult (/Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:111822:42)
    at Object.loadUrl (/Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:130596:51)
    at async flushFileQueue (/Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:130970:28)
    at async /Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:131029:13
    at async onWatchEvent (/Users/megatron/FitCrunch/codebase/snowpack-test/node_modules/snowpack/lib/index.js:130742:9)
npm ERR! code 1
npm ERR! path /Users/megatron/FitCrunch/codebase/snowpack-test
npm ERR! command failed
npm ERR! command sh -c snowpack build

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/megatron/.npm/_logs/2021-03-14T01_13_50_661Z-debug.log

/Users/megatron/.npm/_logs/2021-03-14T01_13_50_661Z-debug.log:

0 verbose cli [
0 verbose cli   '/Users/megatron/.nvm/versions/node/v15.5.0/bin/node',
0 verbose cli   '/Users/megatron/.nvm/versions/node/v15.5.0/bin/npm',
0 verbose cli   'run',
0 verbose cli   'snow'
0 verbose cli ]
1 info using npm@7.6.3
2 info using node@v15.5.0
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/Users/megatron/.nvm/versions/node/v15.5.0/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/Users/megatron/FitCrunch/codebase/snowpack-test/.npmrc Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:/Users/megatron/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/Users/megatron/.nvm/versions/node/v15.5.0/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 6ms
19 verbose npm-session 7c6e9d4dc02787bd
20 timing npm:load Completed in 10ms
21 timing command:run Completed in 7603ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/Users/megatron/.nvm/versions/node/v15.5.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:376:20)
22 verbose stack     at maybeClose (node:internal/child_process:1063:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose cwd /Users/megatron/FitCrunch/codebase/snowpack-test
24 verbose Darwin 18.7.0
25 verbose argv "/Users/megatron/.nvm/versions/node/v15.5.0/bin/node" "/Users/megatron/.nvm/versions/node/v15.5.0/bin/npm" "run" "snow"
26 verbose node v15.5.0
27 verbose npm  v7.6.3
28 error code 1
29 error path /Users/megatron/FitCrunch/codebase/snowpack-test
30 error command failed
31 error command sh -c snowpack build
32 verbose exit 1

I've pushed the very simple demo project here in case anyone would like to repro: https://github.com/joehenry087/snowpack-test

Follow the readme instructions and then just change the contents of the "Sub" module and it will trigger this issue.

I've messed with the snowpack config and verified my node versions and all that... kind of out of options at this point. Would be interested to know if this is just a problem with my setup or with the new HMR work.

Also wanted to say thank you for putting together the new HMR watch stuff @FredKSchott

@joehenry087
Copy link
Contributor

joehenry087 commented Mar 14, 2021

Ah, it seems if there is a svelte file that does not produce a stylesheet it will break. This may be an issue with the Svelte plugin rather than snowpack? I'll keep digging. Just adding some CSS to the svelte modules is a workaround:

<style>
    .test {
        background: red;
    }
</style>

<div class="test">
Test
</div>

@FredKSchott
Copy link
Owner Author

@joehenry087 thanks for posting! I had thought that we found this bug originally and fixed it, will confirm its not a regression.

@FredKSchott
Copy link
Owner Author

strange, I can't reproduce in your repo (npm install, npm start, then npm run snow = no errors in the CLI)

@joehenry087
Copy link
Contributor

@FredKSchott just to confirm, you must then edit the src/Sub.svelte file to trigger the error.

If you did that and it works, it must be a problem with my node or npm or something...

@joehenry087
Copy link
Contributor

It is odd that running npm run snow aka snowpack build doesn't produce the error the first time it builds. Only when editing the file it gets triggered... so maybe something to do with the watch aspect of the code.

@joehenry087
Copy link
Contributor

I am having trouble finding any reference to a previous bug like this.

@FredKSchott
Copy link
Owner Author

I can reproduce! Didn't realize it was only on save, but that made it easy to narrow down. Fixed in e9dfbac, will go out in the next next release. Thanks again for letting us know

@joehenry087
Copy link
Contributor

Brilliant! So glad this was an actual bug, usually it's just me derping on an incorrect configuration 😂

@fabien
Copy link

fabien commented Mar 14, 2021

@FredKSchott regarding this:

NEW: Svelte package SSR support - Svelte packages can ship ".svelte" files in their package distribution, which means that packages are expected to build differently in SSR vs. non-SSR mode. Snowpack now supports this.

I have no issues building the appropriate client/server bundles for production (using @snowpack/webpack-plugin and custom setup) while running 3.1.0-pre.12. However, I'm using the SSR JS Api (runtime.importModule) and I cannot get all of the components to be SSR complient, no matter how I import them:

import EasyrouteProvider from 'svelte-easyroute/lib/EasyrouteProvider.svelte';
import RouterOutlet from 'svelte-easyroute/lib/RouterOutlet.svelte';

The local components work, but none of the components from node_modules dependencies imported by them are compatible. Even though the log shows an entry: + svelte-easyroute@3.0.7 (ssr):

<EasyrouteProvider> is not a valid SSR component

Any thoughts? Has this been tested?

I am working from a Lerna mono-repo and setup workspaceRoot accordingly. Components from those dependencies are ssr'ed correctly, so it seems that it's something particular to external dependencies.

[13:20:41] [snowpack] + svelte@3.35.0
[13:20:42] [snowpack] + svelte-hmr/runtime/hot-api-esm.js@0.12.8
[13:20:43] [snowpack] └── svelte/internal@3.35.0 (dedupe)
[13:20:43] [snowpack] + svelte-easyroute@3.0.7
[13:20:43] [snowpack] + svelte-easyroute@3.0.7 (ssr)
[13:20:43] [snowpack] └── svelte@3.35.0 (dedupe)
[13:20:43] [snowpack] └── easyroute-core@1.3.5
[13:20:43] [snowpack] └── svelte/internal@3.35.0 (dedupe)
[13:20:43] [snowpack] └── easyroute-core/lib/utils@1.3.5 (dedupe)

In addition, when running my app in non-ssr mode (but using the DevServer inside an Express app), I'm getting this error for a component that is linked within the mono-repo:

[15:52:27] [snowpack] Build Result Error: There was a problem with a file build result.
Error: Cannot find module 'svelte-hmr/runtime/proxy-adapter-dom.js' from '/Users/fabien/Development/svelte-development/packages/modules/vanguard/src/svelte/components'
    at Function.resolveSync [as sync] (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/resolve/lib/sync.js:102:15)
    at Object.resolveEntrypoint (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:43580:59)
    at Object.resolvePackageImport (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:54007:34)
    at resolveImport (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:111662:48)
    at /Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:111682:47
    at transformEsmImports (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:47880:37)
    at async FileBuilder.resolveImports (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:111681:24)
    at async loadUrl (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:130594:39)
    at async handleRequest (/Users/fabien/Development/svelte-development/packages/modules/vanguard/node_modules/snowpack/lib/index.js:130666:28) {
  code: 'MODULE_NOT_FOUND'
}
[15:52:27] [snowpack] Error: Cannot find module 'svelte-hmr/runtime/proxy-adapter-dom.js' from '/Users/fabien/Development/svelte-development/packages/modules/vanguard/src/svelte/components'
[15:52:27] [snowpack] [500] /_snowpack/link/modules/vanguard/src/svelte/components/Link.svelte.js

Lastly, the HMR websock at port 3002 (which was setup correctly) doesn't seem to respond since updating to @next:

hmr-client.js:58 WebSocket connection to 'ws://localhost:3002/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

@christophe-g
Copy link
Contributor

@FredKSchott - trying the new release [3.1.0-pre13], as an improved support for linked dependencies is very much welcome (Thank You !). So far with little success.

My app was able to run under 3.0, with a couple of hacks to circumvent linked repositories however (see #2700).

The dev server is unable to find some modules, as I get quite a lot of errors like:

[22:03:16] [snowpack] Server started in 4848ms.
[22:03:16] [snowpack] Local: http://localhost:8080
[22:03:16] [snowpack] Network: http://192.168.0.14:8080
[22:03:23] [snowpack] + dompurify@2.2.6
[22:03:23] [snowpack] + @juggle/resize-observer@3.3.0
[22:03:24] [snowpack] + lit-translate@1.2.1
[22:03:24] [snowpack] └── lit-html@1.3.0 (dedupe)
[22:03:24] [snowpack] └── lit-html/directives/unsafe-html@1.3.0
[22:03:24] [snowpack] + marked/lib/marked.esm.js@2.0.1
[22:03:25] [snowpack] + lit-html/directives/unsafe-html.js@1.3.0
[22:03:29] [snowpack] + lit-html/directives/class-map.js@1.3.0
[22:03:30] [snowpack] + @material/top-app-bar/foundation@9.0.0-canary.1c156d69d.0
[22:03:30] [snowpack] └── @material/base/foundation@9.0.0-canary.1c156d69d.0 (dedupe)
[22:03:30] [snowpack] + @material/top-app-bar/constants@9.0.0-canary.1c156d69d.0
[22:03:31] [snowpack] + @material/top-app-bar/standard/foundation@9.0.0-canary.1c156d69d.0
[22:03:31] [snowpack] └── @material/base/foundation@9.0.0-canary.1c156d69d.0 (dedupe)
[22:03:32] [snowpack] Error: Cannot find module '@material/top-app-bar/foundation' from '/home/christophe/Programming/Polymer/preignition/node_modules/.cache/snowpack/development/@material/mwc-top-app-bar@0.20.0'
    at Function.resolveSync [as sync] (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/resolve@1.20.0/node_modules/resolve/lib/sync.js:102:15)
    at Object.resolveEntrypoint (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:43632:59)
    at Object.resolvePackageImport (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:54048:34)
    at resolveImport (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53978:31)
    at /home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53981:43
    at transformEsmImports (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:47911:37)
    at async Object.load (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53980:23)
    at async loadUrl (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:130479:32)
    at async handleRequest (/home/christophe/Programming/Polymer/preignition/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:130710:28) {
  code: 'MODULE_NOT_FOUND'
}
[22:03:32] [snowpack] Error: Cannot find module '@material/top-app-bar/foundation' from '/home/christophe/Programming/Polymer/preignition/node_modules/.cache/snowpack/development/@material/mwc-top-app-bar@0.20.0'
[22:03:32] [snowpack] [500] /_snowpack/pkg/@material/mwc-top-app-bar.v0.20.0/common/mwc-top-app-bar-base-base-401b50fb.js
[22:03:32] [snowpack] + @preignition/preignition-mixin@1.9.1

Also, it seems that mounted routes are not working anymore when they contain symlinks.

This config is not working anymore, as if __ is not mounted:

mount = {
 __: { url: '/__' }, // /__ is symlinked somewhere in node_modules
}
<script src="/__/firebase/8.2.9/firebase-app.js"></script>

@FredKSchott
Copy link
Owner Author

FredKSchott commented Mar 17, 2021

Huh, that's odd. For some reason Snowpack is treating your preignition/node_modules/.cache/snowpack directory as a source file. Hard to say what's going on from the log, and idea why that may be happening?

Definitely not expected, at the very least we could explore adding an error to the source file builder if it looks like its trying to build a dependency.

Also if __ is a mounted package name, then no more manual mounting needed. Just importing by package name should work: import "__/firebase/8.2.9/firebase-app.js";

@christophe-g
Copy link
Contributor

christophe-g commented Mar 18, 2021

@FredKSchott - thanks a lot

I am trying (hard!) to understand what might be happening, and could reproduce on a simplified test app, by reintroducing dependencies one by one

setup, using pnpm:
workspaceRoot set to '../litElement' where my linked dependencies lies

test app:

dependencies": {
    "@material/base": "^10.0.0",
    "@material/mwc-tab": "^0.20.0",
    "@preignition/preignition-demo": "link:../litElement/preignition-demo",
    "@preignition/preignition-widget": "link:../litElement/preignition-widget",
    "lit-element": "^2.4.0",
    "lit-html": "^1.3.0",
    "router-slot": "^1.5.4"
  },

preignition-widget - some dependencies are also symlinked:

  "dependencies": {
    "@material/... a couple of them ...": "^0.20.0",
    "@preignition/lit-firebase": "link:../lit-firebase",
    "@preignition/preignition-mixin": "link:../preignition-mixin",
    "@preignition/preignition-state": "link:../preignition-state",
    "@preignition/preignition-styles": "link:../preignition-styles",
    "@preignition/preignition-util": "link:../preignition-util",
    "lit-element": "^2.4.0",
    "lit-html": "^1.3.0",
    "tslib": "^2.0.0"
  },

I start to see the 'MODULE_NOT_FOUND' error when I import some @material dependency in preignition-widget.

For instance, if this file importing @material/mwc-select is included in the preignition-widget export:

import { Select } from '@material/mwc-select';
import TwoWaySelectBinding from './two-way-select-binding.js';

/**
 * extension of mwc-textfield emiting a value-changed event when
 * value changes
 */
class PwiSelect extends
TwoWaySelectBinding(
        Select)))) {
  }
}

customElements.define('pwi-select', PwiSelect);

export { PwiSelect };

will generate :

[10:44:08] [snowpack] Error: Cannot find module '@material/mwc-ripple/ripple-handlers' from '/home/christophe/Programming/Polymer/snowpack-test/node_modules/.cache/snowpack/development/@material/mwc-list@0.20.0'
    at Function.resolveSync [as sync] (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/resolve@1.20.0/node_modules/resolve/lib/sync.js:102:15)
    at Object.resolveEntrypoint (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:43632:59)
    at Object.resolvePackageImport (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:54048:34)
    at resolveImport (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53978:31)
    at /home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53981:43
    at transformEsmImports (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:47911:37)
    at async Object.load (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:53980:23)
    at async loadUrl (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:130479:32)
    at async handleRequest (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/snowpack@3.1.0-pre.13/node_modules/snowpack/lib/index.js:130710:28) {
  code: 'MODULE_NOT_FOUND'
}

If I remove this file or remove from the export or remove the import { Select } ... statement, snowpack dev server runs o.k.

Interestingly deduping some dependencies in the test-app (packageOptions.rollup.dedupe) was helping sometimes only. For instance I was able to still make test-app work by deduping @material/mwc-select and @material/mwc-list in the case above.

This workaround did not work in other instances. For instance, importing @material/mwc-textfield is causing the following error, which I cannot work-around either by deduping (or adding as dependencies ) @material/mwc-textfield or @material/texfield

[10:56:11] [snowpack] Error: Cannot find module '@material/textfield/foundation' from '/home/christophe/Programming/Polymer/snowpack-test/node_modules/.cache/snowpack/development/@material/mwc-textfield@0.20.0'
    at Function.resolveSync [as sync] (/home/christophe/Programming/Polymer/snowpack-test/node_modules/.pnpm/resolve@1.20.0/node_modules/resolve/lib/sync.js:102:15)
...
 {
  code: 'MODULE_NOT_FOUND'

@christophe-g
Copy link
Contributor

christophe-g commented Mar 18, 2021

I am also observing some weird stuff re lit-element directives.

First time I run the app (with --reload to clear the cache), the app fails to render, and:

[11:48:34] [snowpack] [Error: ENOENT: no such file or directory, open '/home/christophe/Programming/Polymer/snowpack-test/node_modules/.cache/snowpack/development/lit-html@1.3.0/common/lit-html-86410661.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/christophe/Programming/Polymer/snowpack-test/node_modules/.cache/snowpack/development/lit-html@1.3.0/common/lit-html-86410661.js'
}
[11:48:34] [snowpack] Error: ENOENT: no such file or directory, open '/home/christophe/Programming/Polymer/snowpack-test/node_modules/.cache/snowpack/development/lit-html@1.3.0/common/lit-html-86410661.js'
[11:48:34] [snowpack] [500] /_snowpack/pkg/lit-html.v1.3.0/common/lit-html-86410661.js
[11:48:34] [snowpack] + tslib@2.0.2

Hard refreshing on the browser makes the app renders fined.

Also sometimes the until directive renders its own function as a string, as if duplicate lit-element were running on the browser.


Edit: seems related to #2461

@Negan1911
Copy link
Contributor

Negan1911 commented Mar 31, 2021

Hey @FredKSchott had some time to test this lately and I want to say that it works pretty good, the only downside (that I think that it may be introduced with those changes) is yup not working (looks like the file is not generated correctly), there's a ticket here: #2945 but just wanted to link both tickets since seems that downgrading solves (except if you run a monorepo 😂 )

@theseyi
Copy link

theseyi commented Apr 7, 2021

@BPScott yea, old versions of uuid (pre-export map) don't seem to work with Node's CJS named import scanner and fail in ESM<>CJS envs. You can work around this by adding namedExports, but this package is so popular I think I'll go ahead and add it to always treat uuid as namedExports.
@theseyi thanks for the repro, I'll take a look.
@rmorshea good catch, I naively thought that we could get away from knownEntrypoints because of the new runtime package building, but you're right that import(var) still requires this for build(). I'll see about adding that back.
@Psvensso Can you share the TS project references that you mention? You can scroll up to earlier in this thread where I mention the snowpack:source package.json entrypoint that you can use, will definitely add docs for that before releasing so that it's more clear. Limited sourcemap support is a known limitation of the project (since no core maintainers currently use them in their main dev flow, it hasn't been prioritized. Looking for someone to help implement, if there is interest).

Looking forward to fixing this last batch of issues, and then merging to main! Thanks again to everyone who has helped debug and triage issues! (repro repos are 💯💯💯)

Hey @FredKSchott did you get a change to checkout the repro for this regression? Wanted to followup since someone else is reporting the same but I haven't tested out the latest and greatest

}
}
const isHMR = getIsHmrEnabled(config);
config.buildOptions.resolveProxyImports = !config.optimize?.bundle;
Copy link

@cain-wang cain-wang Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to break image import for bundled builds.
[BUG] sowpack bundle build generate import statement for images and json files

If we turn on optimize.bundle, resolveProxyImports is always going to be false, cause the js bundle to import image files directly:

import logo from './logo.svg''

This can be reproduced with @snowpack/app-template-react by turning on optimized.bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet