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

Breaks if --config was used on command line #5

Open
RedHatter opened this issue Nov 26, 2018 · 4 comments
Open

Breaks if --config was used on command line #5

RedHatter opened this issue Nov 26, 2018 · 4 comments

Comments

@RedHatter
Copy link
Contributor

If this preprocessor gets executed with a command having the --config argument (e.g. rollup --config) I get the following error.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:1090:7)
    at module.exports (/home/timothy/Projects/svelte-material-ui/node_modules/cosmiconfig/index.js:23:31)
    at postcssrc (/home/timothy/Projects/svelte-material-ui/node_modules/postcss-load-config/index.js:48:10)
    at module.exports (/home/timothy/Projects/svelte-material-ui/node_modules/svelte-preprocess-postcss/index.js:10:25)
    at Object.<anonymous> (/home/timothy/Projects/svelte-material-ui/rollup.config.js:25:16)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.require.extensions..js (/home/timothy/Projects/svelte-material-ui/node_modules/rollup/bin/rollup:1271:24)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
@TehShrike
Copy link
Owner

huh, I can't imagine how that would happen. postcss-load-config doesn't look at process.argv. Can you paste some more details, maybe your rollup/svelte config?

@RedHatter
Copy link
Contributor Author

It doesn't require rollup to reproduce. See the following example

const postcss = require('svelte-preprocess-postcss')
const svelte = require('svelte')

svelte.preprocess(`
<style>
  span {
    color: red;
  }
</style>
`, {
  style: postcss()
}).then(console.log)

run with

 node index.js --config

@RedHatter
Copy link
Contributor Author

While postcss-load-config doesn't look at process.argv the version of cosmiconfig that it uses (2.1.0) does. See index.js#L23

@TehShrike
Copy link
Owner

d'oh. That's dumb.

It looks like options are passed straight through from postcss-load-config to cosmiconfig, so passing in argv: false on the options object would probably fix it.

I wonder if that change should be made in postcss-load-config... that seems like bad default behavior

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

2 participants