gucong3000 / postcss-jsx

PostCSS syntax for parsing CSS in JS literals
MIT License
76 stars 28 forks source link

Why put @babel/core in dependencies? #31

Closed leohxj closed 6 years ago

leohxj commented 6 years ago

My project is depend on babel v6 and stylelint. The stylelint dependence on postcss-jsx.

If I install styleint (which will also install postcss-jsx), it will install @babel/core.... And my project build failed. The error is below:

> cross-env NODE_ENV=production webpack --config scripts/webpack.config.prod.babel.js --display-modules

/cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/cli.js:244
                throw err;
                ^

Error: Plugin/Preset files are not allowed to export objects, only functions. In /cloud/source_code/node_modules/babel-preset-stage-2/lib/index.js
    at createDescriptor (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-descriptors.js:178:11)
    at items.map (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-descriptors.js:101:10)
    at presets (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-descriptors.js:47:19)
    at mergeChainOpts (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-chain.js:315:26)
    at /cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-chain.js:278:7
    at buildRootChain (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/config-chain.js:118:22)
    at loadPrivatePartialConfig (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/partial.js:57:55)
    at loadFullConfig (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/full.js:43:39)
    at loadOptions (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/config/index.js:27:36)
    at OptionManager.init (/cloud/source_code/node_modules/_@babel_core@7.0.0@@babel/core/lib/index.js:215:36)
    at compile (/cloud/source_code/node_modules/_@babel_register@7.0.0@@babel/register/lib/node.js:61:42)
    at compileHook (/cloud/source_code/node_modules/_@babel_register@7.0.0@@babel/register/lib/node.js:102:12)
    at Module._compile (/cloud/source_code/node_modules/_pirates@4.0.0@pirates/lib/index.js:77:29)
    at Module._extensions..js (module.js:646:10)
    at Object.newLoader [as .js] (/cloud/source_code/node_modules/_pirates@4.0.0@pirates/lib/index.js:88:7)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (/cloud/source_code/node_modules/_v8-compile-cache@2.0.2@v8-compile-cache/v8-compile-cache.js:159:20)
    at WEBPACK_OPTIONS (/cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/convert-argv.js:133:13)
    at requireConfig (/cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/convert-argv.js:135:6)
    at /cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/convert-argv.js:142:17
    at Array.forEach (<anonymous>)
    at module.exports (/cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/convert-argv.js:140:15)
    at yargs.parse (/cloud/source_code/node_modules/_webpack-cli@3.1.0@webpack-cli/bin/cli.js:241:39)
    at Object.parse (/cloud/source_code/node_modules/_yargs@12.0.1@yargs/yargs.js:563:18)

I don't know why cause this problem, but I think @babel/core should in devDependencies, right?

leohxj commented 6 years ago

Sorry, It's autoprefixer error, it latest version (9.1.4) has dependence on @babel/regisiter, so it use @babel/core ..