Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.2.0 breaks parts of code loaded with ref-loader #85

Open
marapper opened this issue May 30, 2020 · 1 comment
Open

v5.2.0 breaks parts of code loaded with ref-loader #85

marapper opened this issue May 30, 2020 · 1 comment

Comments

@marapper
Copy link

marapper commented May 30, 2020

We use extract-loader to compose template files like this:

// index.js
import template from '!file-loader!extract-loader!ref-loader!./template.soy';

// template.soy 
@ref(!ref-loader!./Part1.soy)
@ref(!ref-loader!./Part2.soy)

// Part1.soy
{template .Part1}
    {foreach $key in keys($ij.pageItem.preferences)}
        {if matches($key, '^visible_.*$')}
		{/if}
    {/foreach}
{/template}

// Part2.soy
{template .Part2}
{/template}

After upgrade extract-loader to v5.2.0 whole code part after $ is not included in result file. Downgrade extract-loader to v5.0.1 only works fine.

e.g. produce

// template.soy
{template .BackbaseModel}
    {foreach $key in keys($ij.pageItem.preferences)}
        {if matches($key, '^visible_.*$

{template .Part2}
{/template}

I suppose it's regex-relative thing.
Probably somewhat connected with #57 and #54 ()

@marapper
Copy link
Author

marapper commented Jan 4, 2022

#83 connected

src/extractLoader.js:175

should be


return content.replace(pattern, () => dependencyContent);

because replace callbacks ignore special sequences like $'

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

No branches or pull requests

1 participant