FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

svelte: add svelte-preprocess as a dependency #93

Closed rondonjon closed 4 years ago

rondonjon commented 4 years ago

PR #50 has added preprocessor support for svelte (which is great :+1:, thanks), but I struggled to get it to work, and the error message that I was getting honestly didn't help me too much:

  build:svelte............[ERROR] (plugin) @snowpack/plugin-svelte

▼ build:svelte

  Identifier is expected

I was able to solve the problem by installing svelte-preprocess manually.

If this should remain an optional dependency, I think it should be documented (or documented more prominently if it already is).

Since preprocessing is a pretty common thing in svelte, I would rather suggest to just add svelte-preprocess as a dependency directly though.

FredKSchott commented 4 years ago

Thanks for filing! I'm surprised to hear that, i don't see anywhere in the docs a mention that you need svelte-preprocess installed for svelte.preprocess() to run. https://svelte.dev/docs#svelte_preprocess. We should definitely improve that error message, regardless.

Mind adding some steps for me to reproduce in the Svelte CSA app? What your svelte.config.js file looks like and any dependencies you installed on top of the base setup it should be enough to debug. Thanks!

rondonjon commented 4 years ago

Hi @FredKSchott, thanks for the superfast reponse :rocket: :+1: :+1:

Turned out that it was me who introduced this additional dependency with my very own svelte.config.js file :roll_eyes: Sorry

const sveltePreprocess = require("svelte-preprocess");

module.exports = {
  preprocess: sveltePreprocess()
};
FredKSchott commented 4 years ago

haha no worries! I figured this may have been the case :)

I'm still surprised you got "Identifier is expected" and not "svelte-preprocess" not found. Tracked it down to us swallowing the error, fixed in b22b1c3