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

Webpack 4 - Replace values inside json file #68

Open
Stebeber opened this issue Jun 4, 2021 · 1 comment
Open

Webpack 4 - Replace values inside json file #68

Stebeber opened this issue Jun 4, 2021 · 1 comment

Comments

@Stebeber
Copy link

Stebeber commented Jun 4, 2021

Hello everyone,

I am using Webpack 4.46.0 with "string-replace-loader" 2.3.0.

I am not able to replace any strings in my *.json files. I have various "app.json" files in different folders - therefore I want to replace some values inside.

Config:

 module: {
    rules: [
      {
        test: /app\.json$/,
        loader: 'string-replace-loader',
        options: {
          multiple: [
            { search: './data_a', replace: '../../data_a', flags: 'g'},
            { search: './data_b', replace: '../../data_b', flags: 'g' },
          ],
        },
      },

Any ideas what I am doing wrong?

@Stebeber
Copy link
Author

Stebeber commented Jun 7, 2021

rules: [
      {
        test: /\.json$/,
        loader: 'string-replace-loader',
        options: {
          search: './data',
          replace: '../../data',
          flags: 'g',
          strict: true,
        },
      },

Using strict mode fails - so it seems to me that the files are not found. Any ideas?

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