Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Legacy client code not parsing __SAPPER_CSS_PLACEHOLDER #439

Closed
silentworks opened this issue Sep 13, 2018 · 2 comments
Closed

Legacy client code not parsing __SAPPER_CSS_PLACEHOLDER #439

silentworks opened this issue Sep 13, 2018 · 2 comments

Comments

@silentworks
Copy link
Contributor

silentworks commented Sep 13, 2018

It seems the legacy client code is not parsing the PLACEHOLDER text, this can be seen from the resulting output in the build directory.

Here is part of the output from build/client/client.******.js:

{
    pattern:/^\/about\/?$/,
    parts:[{
        component: {
            js:()=>import("./about.2dbe86cf.js"),
            css:["about.2dbe86cf.css","chunk.953bc4b7.css"]
        }
    }]
}

Here is part of the output from build/client/legacy/client.******.js:

{
    pattern:/^\/about\/?$/,
    parts:[{
        component:{
            js:function(){return import("./about.627078a3.js")},
            css:"__SAPPER_CSS_PLACEHOLDER:about.html__"
        }
    }]
}

This seem to be an issue at build time, it seems that build/client/client.******.js gets parsed by the extract_css function and written to file

fs.writeFileSync(`${dirs.dest}/client/${main}`, replaced);
, while build/client/legacy/client.******.js doesn't.

@silentworks
Copy link
Contributor Author

silentworks commented Sep 13, 2018

I have a solution but it feels very much like a nasty hack.

In build.ts before line 83 I added client_result.to_json(manifest_data, dirs); and then inside of extract_css.ts after line 172 I added:

if (process.env.SAPPER_LEGACY_BUILD)
        main = `legacy/${main}`;

@Rich-Harris
Copy link
Member

Released 0.20.4 with the fix — thank you

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

No branches or pull requests

2 participants