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

Loader for SVG files generates bundle name twice on production build #16

Open
lmartins opened this issue Jan 5, 2022 · 2 comments
Open
Labels
Type: Question Further information is requested

Comments

@lmartins
Copy link

lmartins commented Jan 5, 2022

This is most likely a mistake on my end, as wpackio is otherwise working absolutely brilliantly.
I've extended Webpack configuration to be able to handle SVG files called from SCSS, I've done so following the docs to this result:

      webpackConfig: (config, merge, appDir, isDev) => {
        const customRules = {
          module: {
            rules: [
              {
                test: /\.(svg|mp4|webm)$/,
                issuer: issuerForNonJsTsFiles,
                use: [
                  {
                    loader: 'file-loader',
                    options: getFileLoaderOptions(appDir, isDev, false),
                  },
                ],
              },
            ],
          }
        };
        return merge(config, customRules);
      },

This works well in development mode, generating URLs for the SVG files like this:

https://192.168.86.81:3000/wp-content/themes/has2022/dist/app/assets/left_cutout-ea61de20.svg

However when I run the production build, I get a url like this:

https://site.wpengine.com/wp-content/themes/has2022/dist/app/app/assets/left_cutout-ea61de20.svg

Notice that is adding /app twice. The assets was correctly placed into the assets folder, its just that double /app name in the file path that is causing it to break.

Is this due to my configuration for the loader, or something else?

Thank you so much for this amazing tool!

@derweili
Copy link
Contributor

derweili commented Feb 7, 2022

@lmartins could you provide your wpackio.project.js and the PHP code loading the scripts?

@derweili
Copy link
Contributor

derweili commented Feb 7, 2022

There is probably something wrong with your paths.

@swashata swashata added the Type: Question Further information is requested label Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants