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

TypeError: content.match is not a function #53

Open
Abdull opened this issue Feb 18, 2022 · 5 comments
Open

TypeError: content.match is not a function #53

Abdull opened this issue Feb 18, 2022 · 5 comments

Comments

@Abdull
Copy link

Abdull commented Feb 18, 2022

Using

npm: 8.4.0
webpack: 5.52.1
fontmin-webpack: 3.2.0

I set up FontminPlugin in my webpack project as per its documentation (following reduced to minimal setup):

const FontminPlugin = require('fontmin-webpack');

module.exports = {
  entry: 'my-entry.js',
  output: {
    // ...
  },
  plugins: [
    // ...
    new FontminPlugin({
      autodetect: true
    })
  ],
}

I get the following TypeError when running my webpack build:

$ npm run build

> myproject@1.0.0 build
> webpack

myproject/node_modules/fontmin-webpack/lib/index.js:117
        const matches = content.match(GLYPH_REGEX) || []
                                ^

TypeError: content.match is not a function
    at myproject/node_modules/fontmin-webpack/lib/index.js:117:33
    at arrayMap (myproject/node_modules/lodash/lodash.js:653:23)
    at Function.map (myproject/node_modules/lodash/lodash.js:9622:14)
    at interceptor (myproject/node_modules/lodash/lodash.js:17094:35)
    at Function.thru (myproject/node_modules/lodash/lodash.js:8859:14)
    at myproject/node_modules/lodash/lodash.js:4430:28
    at arrayReduce (myproject/node_modules/lodash/lodash.js:697:21)
    at baseWrapperValue (myproject/node_modules/lodash/lodash.js:4429:14)
    at LodashWrapper.wrapperValue (myproject/node_modules/lodash/lodash.js:9114:14)
    at FontminPlugin.findUnicodeGlyphs (myproject/node_modules/fontmin-webpack/lib/index.js:138:8)
@patrickhulce
Copy link
Owner

patrickhulce commented Feb 18, 2022

Thanks for filing @Abdull! Would you mind sharing what's in your // ... and entry file?

Our test cases look exactly like our readme and are passing on webpack 5, so I suspect interplay with another plugin or content type.

@ArTiSTiX
Copy link
Contributor

I had this issue using another plugin MiniCssExtractPlugin.

My solution was to put the Fontmin-Webpack plugin before MiniCssExtractPlugin and it disappeared.

ENV: using the Asset Modules and no file-loader, with Webpack@5.65.0, MiniCssExtractPlugin@2.4.5

@qiutian00
Copy link

I have the same problem

@patrickhulce
Copy link
Owner

@qiutian00 did the advice of other posters to respect the order of plugins in the example work?

What other plugins are you using?

@qiutian00
Copy link

@qiutian00 did the advice of other posters to respect the order of plugins in the example work?

What other plugins are you using?

Not solved this problem, finally, I use the online site to convert font https://transfonter.org/

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

4 participants