Skip to content

Commit

Permalink
svelte preprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Mar 18, 2022
1 parent 8483bba commit 67b305a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions svelte.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Chomp.addExtension('[email protected]:npm');

Chomp.registerTemplate('svelte', function ({ name, targets, deps, env, templateOptions: { svelteConfig = null, sveltePreprocess = !svelteConfig, sourceMaps = true, autoInstall, ...invalid } }) {
Chomp.registerTemplate('svelte', function ({ name, targets, deps, env, templateOptions: { svelteConfig = null, sveltePreprocess = true, sourceMaps = true, autoInstall, ...invalid } }) {
if (Object.keys(invalid).length)
throw new Error(`Invalid svelte template option "${Object.keys(invalid)[0]}"`);
return [{
Expand All @@ -18,8 +18,8 @@ Chomp.registerTemplate('svelte', function ({ name, targets, deps, env, templateO
${sveltePreprocess ? ` import sveltePreprocess from 'svelte-preprocess';\n` : ''}
${svelteConfig
? `const { default: svelteConfig } = await import(${svelteConfig === true ? '"./svelte.config.js"' : svelteConfig});`
: `const svelteConfig = {${sveltePreprocess ? ' preprocess: sveltePreprocess() ' : ''}};`}
: `const svelteConfig = {};`}
${sveltePreprocess ? ` svelteConfig.preprocess = svelteConfig.preprocess || sveltePreprocess;\n` : ''}
const filename = process.env.DEP;
const compilerOptions = {
css: false,
Expand Down

0 comments on commit 67b305a

Please sign in to comment.