-
Notifications
You must be signed in to change notification settings - Fork 414
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
Error when evaluating the expression: (0, ...) is not a function #1303
Comments
Hi @PierreGUI! If it's not something sensitive, could you please provide the code from logs behind |
Sure thing, I trimmed the files from other imports/exports: Untransformedconstants/style.ts export enum Size {
xs = 'xs',
sm = 'sm',
md = 'md',
lg = 'lg',
xl = 'xl',
xxl = 'xxl'
}
export enum Breakpoint {
xs = 375,
sm = 576,
md = 768,
lg = 930,
xl = 1200,
xxl = 1350,
}
export type ZIndex = 0 | 1 | 2 | 3 | 4 | 5
export const ZIndex = [
2, // 0
4, // 1
6, // 2
8, // 3
10, // 4
12, // 5
] utils/style.ts import { Breakpoint, FontSize, Size, SongBreakpoint, Space, Spacing, ZIndex } from '~/constants/style'
export function minWidth (min: Size | number): string {
return `(min-width: ${typeof min === 'number' ? min : Breakpoint[min]}px)`
}
export function zi (index: ZIndex): number { return ZIndex[index] } Transformedutils/style.ts "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.minWidth = minWidth;
exports.zi = zi;
var _style = require("../constants/style");
function minWidth(min) {
return `(min-width: ${typeof min === 'number' ? min : _style.Breakpoint[min]}px)`;
}
function zi(index) {
return _style.ZIndex[index];
} Note: these functions and constants are used all across my codebase and do not seem to trigger an error in most cases. I can build one entrypoint using those. |
Also note, the build for this single entrypoint was failing until I removed the import { /* no css */ } from '@linaria/core'
const containerCSS = `
@media ${minWidth(ASIDE_BREAK_POINT)} {
...
}
` But while it fixes this specific case of the build error, I still have a few entrypoint which won't build. Some variable or some function evaluate to |
Okay, the shaker works correctly, but apparently the evaluation or code cache wasn't updated. The cache was initialized with zi, and when some other code later tries to import minWidth, it still evaluates as undefined. Should be easy now. Thank you! |
Fixed in Linaria 5 |
Environment
Description
The build error happens pretty close to the previous one (#1287), although not it originates from the function rather than the variable. I have the error even when I build only one single webpack entrypoint.
Shortened error:
Reproducible Demo
Can't reproduce outside my codebase, currently.
Related code:
Although the error happens in different files under different forms, here's one:
Extract from debug output, where
minWidth
isundefined
:Extract from debug output:
module:00007
beforeminWidth
isundefined
:The text was updated successfully, but these errors were encountered: