-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix transforming via API #53
Conversation
- forbid the option when transforming a file Fixes #52.
@danoc, can you test out this solution? |
const { ignorePattern, caseSensitive } = state.opts; | ||
const { file } = state; | ||
const { ignorePattern, caseSensitive, filename: providedFilename } = state.opts; | ||
const { file, filename } = state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like filename
was originally coming from state.file.opts
on ln 47, was this updated somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no longer using that value, but it seems like it will be populated by state.filename
when transforming a file, and state.opts.filename
when the option is provided, so this seemed more straightforward.
Hi, a few minutes late to the party but when I test this locally I get the following error:
Does If I omit
|
@danoc what config are you using with that first error? |
@ljharb Using this config:
If I change filename to
Could be something wrong on my end. I'm testing this by pulling down the code in this PR, building the |
@danoc when providing options to a plugin, you need an extra wrapping array. Try this: const es = babelTransform(buildFile(componentName, path), {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [['inline-react-svg', { filename: 'unknown' }]],
babelrc: false,
}).code; |
Ah, nice catch. That was the issue. I really appreciate your help on this! 🙇 |
No description provided.