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 encore compatibility issue. #50

Open
kasperkowalski opened this issue Jan 12, 2021 · 2 comments
Open

Webpack encore compatibility issue. #50

kasperkowalski opened this issue Jan 12, 2021 · 2 comments

Comments

@kasperkowalski
Copy link

kasperkowalski commented Jan 12, 2021

Hi

I've tried to run the plugin along with my webpack-encore configuration. But unfortunately i'm gettimg this error message:

Syntax Error: ModuleNotFoundError: Module not found: Error: Can't resolve '~/Users/..../frontend/assets/node_modules/iconfont-webpack-plugin/placeholder.svg' in '/Users/..../frontend/assets/src/common'

I've checked the path and the file is there however it's empty.

My webpack-encore config looks like this:

[...]
    .enablePostCssLoader((options) => {
        options.postcssOptions = (loader) => {
            return {
                plugins: [
                    new IconfontWebpackPlugin({
                        resolve: loader.resolve,
                        fontNamePrefix: 'custom-',
                        enforcedSvgHeight: 1000,
                    })
                ]
            }
        }
        return options;
    })

icons.scss:

.icon-ranking:before {
  font-icon: url('icons/ranking.svg');
}

.icon-rating:before {
  font-icon: url('icons/rating.svg');
}

and package.json deDependencies section

  "devDependencies": {
    "@symfony/webpack-encore": "^0.33.0",
    "autoprefixer": "^9.0.0",
    "css-loader": "^5.0.1",
    "iconfont-webpack-plugin": "^5.0.0",
    "postcss": "^8.2.4",
    "sass": "^1.32.0",
    "sass-loader": "^10.1.0"
  },

TIA for any advice

@jantimon
Copy link
Owner

The ~ is wrong maybe a outdated css-loader option?

@sanderquirynen
Copy link

I get the same type of error when upgrading from postcss-loader version 3.x to 4.x (also on 5.x).

Sadly the newer version of Webpack Encore (1.x) requires postcss-loader ^4.0.0 || ^5.0.0.

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

3 participants