当我尝试使用样式组件运行 Nextjs 项目时,我遇到了此错误。
这是我的 .babelrc
{
"plugins": [
[
"babel-plugin-styled-components",
{
"ssr": true,
"displayName": true
}
]
],
"presets": ["next/babel", "@babel/preset-typescript"]
}
Run Code Online (Sandbox Code Playgroud)
这是我的 next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
styledComponents:
Boolean |
{
displayName: Boolean | undefined,
ssr: Boolean | undefined
}
}
module.exports = nextConfig
Run Code Online (Sandbox Code Playgroud)
那么这是我的错误:语法错误:“next/font”需要 SWC,尽管由于存在自定义 babel 配置而正在使用 Babel。了解更多: https: //nextjs.org/docs/messages/babel-font-loader-conflict
我尝试在 next.config.js 中使用自定义 babel 配置,但没有按预期工作。
而且,这是我的_Document:
import Document, {
Html,
Head,
Main,
NextScript,
DocumentContext
} from 'next/document'
import { ServerStyleSheet } from …
Run Code Online (Sandbox Code Playgroud) 我在fla中有一堆图形资源,MovieClip链接到某些类.我将fla导出为swc,我将其添加到我的库中,并选择"Merged into Code".
一切都很好,我可以创建我的MovieClip的实例,只需通过这样调用他们的类.
//example 1
var newMc:BaseClass = new GraphicAsset();
Run Code Online (Sandbox Code Playgroud)
现在,如果我想要执行以下操作,Flash会抛出错误,GraphicsAssetClass为null!
//example 2
var GraphicsAssetClass:Class = getDefinitionByName("GraphicAsset") as Class;
Run Code Online (Sandbox Code Playgroud)
我可以让上述线路工作的唯一方法就是这样做
//example 3
var newMc:GraphicAsset;
var GraphicsAssetClass:Class = getDefinitionByName("GraphicAsset") as Class;
//then I'm able to do this
var newMc:BaseClass = new GraphicsAssetClass();
Run Code Online (Sandbox Code Playgroud)
您能想到一个解决方案吗?我可以通过调用getDefinitionByName()来简单地获取类,就像我在示例2中那样,而不必求助于示例3解决方案.
我有一个打字稿项目,我正在使用 swc 进行编译。我无法让 swc 解析 或 中定义的路径tsconfig.json
别名.swcrc
。eslint 可以正确解析模块别名,并且在未将 swc 指定为编译器的情况下运行 ts-node 时,可以正确解析模块别名。
鉴于此拉取请求,似乎 swc 应该能够解析tsconfig.json
并支持 中定义的路径别名.swcrc
。然而,似乎人们在使用此功能后也遇到了与我类似的问题,尽管那是两年前的事了,我无法想象此后还没有解决方案。
另外,在一个奇怪的旁注中,实现 TSConfigResolver 的 PR 的作者在他的 PR 合并一年后的一个问题中提到了 swc“不考虑 tsconfig”。虽然这不应该是我的问题的根源,因为我在中指定了相同的路径别名.swcrc
swc 文档非常模糊,没有提及任何有关模块别名或解析 tsconfig 的内容,除此之外,jsc.baseUrl
它们jsc.paths
是编译选项,并且它们与 tsconfig 语法匹配。
任何帮助或指导将不胜感激,谢谢!
tsconfig.json
{
"compilerOptions": {
"target": "es2020",
"module": "ESNext",
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"$lib/*": ["src/lib/*"]
},
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"ts-node": …
Run Code Online (Sandbox Code Playgroud) 当我安装 swc 时,出现此错误:找不到模块“path-to-project/src/app.module”
我在用着:
“ dist/main.js ”
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
const _cors = /*#__PURE__*/ _interop_require_default(require("@fastify/cors"));
const _csrfprotection = /*#__PURE__*/ _interop_require_default(
require("@fastify/csrf-protection"),
);
const _helmet = /*#__PURE__*/ _interop_require_default(
require("@fastify/helmet"),
);
const _common = require("@nestjs/common");
const _config = require("@nestjs/config");
const _core = require("@nestjs/core");
const _platformfastify = require("@nestjs/platform-fastify");
const _swagger = require("@nestjs/swagger");
const _appmodule = require("path-to-projects/src/app.module");
function _interop_require_default(obj) {
return obj && obj.__esModule
? obj
: {
default: obj,
};
}
async function …
Run Code Online (Sandbox Code Playgroud) 有谁知道criterea Flash用于发现Component的Live Preview类的内容?
背景
我们正在尝试自动创建包含要在Flash中使用的组件的SWC.我们可以通过修改manifest.xml并连接组件定义来使它对flash可见.但是,组件无法拖到舞台(或库)上,可能是因为它没有LivePreview的形式.
为了更好地说明我们的来源,我们注意到从Flash导出的SWC中的以下内容(使用swfdump):
fl.livepreview.LivePreviewParent
包含与mod
manifest.xml文件中的可视组件相同的属性fl.livepreview.LivePreviewParent
导出为符号但是,我发现它与Flex的SWC之间没有其他区别.
我们显然可以使用JSFL来执行任务,但我们宁愿不在构建服务器上安装Flash.
有什么想法吗?
使用Flash CS4,我正在制作一个有十几个声音和几首音乐曲目的游戏.为了减少发布/编译时间,我将声音和音乐移动到(外部)SWC中,该SWC位于项目的"库路径"中.这有效,但有一点需要注意......
在我将资产外部化之前,我通过获取类来动态地实例化Sound
嵌入声音的对象getDefinitionByName
.
// something like...
var soundSubClass:Class = Class(getDefinitionByName(soundClassName));
var mySound:Sound = new soundSubClass();
Run Code Online (Sandbox Code Playgroud)
但是现在它们位于外部SWC中,我需要对这些类进行"具体"引用,以便像这样加载它们,否则它们不包含在已发布的SWF中,并且在getDefinitionByName
尝试时出现运行时错误得到一个不存在的类.
所以,我的问题是:在Flash Professional CS4中,有没有办法强制包含库的资产,无论它们是否静态链接?
FlashDevelop有一个编译器选项"SWC Include Libraries",这正是我想要的,与"SWC Libraries"选项不同."SWC包含库"选项的描述是"将SWC文件中的所有类链接到生成的应用程序SWF文件,无论它们是否被使用."
(另外,对我来说重要的是所有资产都包含在一个已编译的SWF中.在运行时链接不是我想要的.)
将SWC库链接到flex应用程序有三种模式:"合并到代码","外部"和"RSL".我理解什么是"RSL",但我不明白什么是"外部".
"RSL"对我来说很好,没有任何代码更改.但是,外部对我不起作用.虽然我的应用程序启动,但从未找到SWC设置为External的类.
如果不是"RSL","外部"是什么意思?我该如何使用它?
谢谢你,鲍里斯
有谁知道什么是SWC以及我们在Flash开发中使用此SWC的位置?
swc ×10
flash ×6
apache-flex ×4
actionscript ×1
babeljs ×1
flash-cs3 ×1
nestjs ×1
next.js ×1
node.js ×1
reactjs ×1
rsl ×1
swc-compiler ×1
typescript ×1