Skip to content

Commit

Permalink
Fix preprocessors in config files (#88)
Browse files Browse the repository at this point in the history
These two bugs prevented the `preprocess` option from actually being used. The first bug was accidentally using the preprocess function as an argument to itself. The second bug was not awaiting `getConfig`, which is async.
  • Loading branch information
rogueg authored and DeMoorJasper committed Aug 16, 2019
1 parent a039d80 commit 9641112
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/parcel-plugin-svelte/lib/svelte-asset.js
Expand Up @@ -22,12 +22,13 @@ class SvelteAsset extends Asset {
// Note: "compilerOptions" is deprecated and replaced by compiler.
// Since the depracation didnt take effect yet, we still support the old way.
const compiler = { ...customOptions.compilerOptions, ...customOptions.compiler, ...parcelCompilerOptions };
const preprocess = customOptions.preprocess

return { compiler, preprocess };
}

async generate() {
const config = this.getConfig();
const config = await this.getConfig();

if (config.preprocess) {
const preprocessed = await preprocess(this.contents, config.preprocess, config.compiler);
Expand Down

0 comments on commit 9641112

Please sign in to comment.