getsentry / babel-gettext-extractor

A fork of babel-gettext-plugin that works with older versions of node and supports comment and location extraction
MIT License
43 stars 22 forks source link

Plugin provided an invalid property of "default" #4

Open mandx opened 7 years ago

mandx commented 7 years ago

Using babel-core@6.22.1, webpack@2.2.1, Node.js@v7.5.0 and this .babelrc file:

{
  "presets": [
    ["latest", {
      "es2015": {
        "modules": false
      }
    }],
    "stage-3",
    "react"
  ],
  "plugins": [
    "babel-plugin-transform-class-properties",
    "babel-plugin-transform-runtime",
    "babel-gettext-extractor",
    "./bin/babel-relay-schema-plugin"
  ]
}

After a quick googling, I went into my local node_modules/babel-gettext-extractor and changed this line from:

exports.default = function() {

to:

module.exports = function() {

And then it worked perfectly.

Is there a Babel config option I'm missing?

mandx commented 7 years ago

Full stacktrace:

ERROR in ./src/index.js
Module build failed: Error: Plugin 2 specified in "/project/path/.babelrc" provided an invalid property of "default"
    at Plugin.init (/project/path/node_modules/babel-core/lib/transformation/plugin.js:131:13)
    at Function.normalisePlugin (/project/path/node_modules/babel-core/lib/transformation/file/options/option-manager.js:152:12)
    at /project/path/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
    at Array.map (native)
    at Function.normalisePlugins (/project/path/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/project/path/node_modules/babel-core/lib/transformation/file/options/option-manager.js:233:36)
    at OptionManager.init (/project/path/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
    at File.initOptions (/project/path/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/project/path/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/project/path/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/project/path/node_modules/babel-loader/lib/index.js:38:20)
    at Object.module.exports (/project/path/node_modules/babel-loader/lib/index.js:133:12)
 @ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server babel-polyfill ./index.js
colinwren commented 7 years ago

I have ran into the exact same problem. @mandx your fix worked for me, thanks!

mandx commented 7 years ago

@colinwren Well is not really a fix, is more like a workaround to get it working locally. This is still a problem since the "fix" is not available in new installations.