Closed HarbingerNight closed 3 years ago
What version of Parcel you are using?
"parcel": "^2.0.0-beta.1", "parcel-transformer-svelte": "^1.1.0", "svelte": "^3.31.2"
Same for me, with a Parcel nightly. A non-minimal repro: https://github.com/npmhub/npmhub/blob/1c9ba30e4e5834175b03ef255d114eade49ed3ce/package.json
config
is literally null
in transform
I've patched it locally (for now) to work like this:
diff --git a/node_modules/parcel-transformer-svelte/index.js b/node_modules/parcel-transformer-svelte/index.js
index 6a4fa00..6cdead3 100644
--- a/node_modules/parcel-transformer-svelte/index.js
+++ b/node_modules/parcel-transformer-svelte/index.js
@@ -55,12 +55,12 @@ exports.default = new Transformer({
let code = await asset.getCode();
const sourceFileName = relativeUrl(options.projectRoot, asset.filePath);
const compilerOptions = {
- ...config.raw.compilerOptions,
+ ...(config && config.raw && config.raw.compilerOptions || {}),
filename: sourceFileName,
name: generateName(sourceFileName),
};
- if (config.hydrated.preprocess) {
+ if (config && config.hydrated && config.hydrated.preprocess) {
const preprocessed = await handleError(sourceFileName, () =>
preprocess(code, config.hydrated.preprocess, compilerOptions),
);
But I'm pretty much unsure if this is OK or just masking the real issue
UPD: so far it looks like the plugin doesn't expect people to be using the default Svelte config without any customizations.
Thanks, you help me a lot because I hadn't time to check it on this week. I'll publish a new version soon.
That was fast ;) Thanks
🚨 Build failed. parcel-transformer-svelte: Cannot read property 'raw' of null
Error on all parcel 2 svelte builds regardless of app. Have tested with multiple apps including Base Examples installed in clean directory. Same Error regardless.
Occurs w/ version 1.1.0 Works fine w/ version 1.0.8