Skip to content

esModule file-loader compat #2613

@eric-hemasystems

Description

@eric-hemasystems

I recently upgraded an app from webpacker 4 -> 5. When I did that my "fontawesome" icons went away. I found the font was not loading despite being in the static_assets_extensions. When I looked at the compiled CSS it looked like:

@font-face {
  font-family: 'FontAwesome';
  src: url([object Module]);
  src: url("[object Module]?#iefix&v=4.7.0") format("embedded-opentype"), url([object Module]) format("woff2"), url([object Module]) format("woff"), url([object Module]) format("truetype"), url("[object Module]#fontawesomeregular") 

I did a search and found a related issue on stack overflow that indicates adding esModule: false to the fileloader options:

https://stackoverflow.com/questions/57671995/webpack-4-gives-background-urlobject-module-as-bg-image

I looked at the file-loader package and it appears in v5 they made a breaking change documented as:

switch to ES modules by default (the option esModule is true by default)

Since the file-loader config is controlled by webpacker making that config change would not be easy to do. Instead I downgraded to version 4.3 of file-loader and things are now working fine.

Seems either webpacker needs to be updated to use this esModule: false option or some other change needs to be made so it is compat with the new way file-loader is doing things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions