-
Notifications
You must be signed in to change notification settings - Fork 415
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: handle .cjs & .mjs extensions #1181
Conversation
🦋 Changeset detectedLatest commit: 95f2598 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
rules: [ | ||
{ | ||
action: evaluator, | ||
}, | ||
{ | ||
test: /\/node_modules\//, | ||
action: 'ignore', | ||
}, | ||
], |
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.
rules
are not used in Module
, so I removed it and the evaluator()
as it caused a false expectation that a required file will be evaluated.
Hm... Getting an interesting failure now:
In code: import { styled } from "@linaria/react";
import { cx } from "@linaria/core";
export {
css_default as css,
cx,
styled
}; It seems that |
01734f9
to
95f2598
Compare
Naive fix for the problem is to add a check to const processTemplateExpression = (
p: NodePath<Identifier>,
fileContext: IFileContext,
options: Pick<
StrictOptions,
'classNameSlug' | 'displayName' | 'evaluate' | 'tagResolver'
>,
emit: (processor: BaseProcessor) => void
) => {
+ if (p.parentPath.isExportSpecifier()) return;
if (processed.has(p.node)) return;
const tagProcessor = getTagProcessor(p, fileContext, options); I don't see any case when |
Motivation
Fixes #1177.
Summary
This PR adds
.cjs
&.mjs
to the list of default ones, so Linaria will handle them and load them properly.Before
After
Test plan
I didn't find a proper place to test it, it seems that
module.test.ts
is nearest, so I modified it.