Yoast / YoastSEO.js

Analyze content on a page and give SEO feedback as well as render a snippet preview.
GNU General Public License v3.0
403 stars 170 forks source link

Yoast seo version 1.36.0 doesnt work with webpack version 3.12.0 #1662

Open savithapremkumar opened 6 years ago

savithapremkumar commented 6 years ago

Yoast seo worked with previous version of webpack

after updating webpack to version 3.12.0, yoast doesnt work with the error "Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'"

package yoast with webpack using this command : "npm run cross-env NODE_ENV=production webpack --progress --hide-modules"

Hint : looks like this is linked to this issue : https://github.com/webpack/webpack/issues/3997

Technical info

  • Platform: Standalone
  • Platform version:
  • Yoast SEO version:1.36.0
alexluong commented 6 years ago

I also ran into this problem. Would love to know a solution. I want to use YoastSEO.js in a React + Electron app.

AubreyHewes commented 6 years ago

@savithapremkumar @alexluong

If using babel-loader in your webpack config you can change the loader exclude property configuration:

{
  test: /\.jsx?$/,
  exclude: /node_modules\/(?!(yoastseo)\/).*/,
  use: {
    loader: 'babel-loader',
    options: {
      cacheDirectory: true,
    },
  }
},

This ignores all node_modules except yoastseo. It is also how they use it. See https://github.com/Yoast/wordpress-seo/blob/01b3bf65d11ad1f55a07882c4683dc13e0cd69cd/webpack/webpack.config.js#L72