我目前正在构建一个Ionic 2-RC3应用程序.但是自从我升级到RC-1后,我遇到了以下错误:(不确定他们是否保持不变,但你明白了).
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'TextAst' from
both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'BoundTextAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'AttrAst' from
both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'BoundElementPropertyAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'BoundEventAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting …Run Code Online (Sandbox Code Playgroud) 我将 Vue 的单文件组件规范 ( *.vue) 用于我的应用程序中的自定义组件。与rollup和一起rollup-plugin-vue,我观察到 DOM 中的输出,对于我编写的自定义组件,由等效的 html 元素组成。
例如:
component-a.vue
<template>
<span>Hello World</span>
</template>
<script>
export default { name: 'component-a' };
</script>
Run Code Online (Sandbox Code Playgroud)
component-b.vue
<template>
<component-a></component-a>
</template>
<script>
import ComponentA from './path/to/component-a.vue';
export default { name: 'component-b', components: { ComponentA } };
</script>
Run Code Online (Sandbox Code Playgroud)
上面的例子,如果component-a被添加到 Vue 挂载组件中,将会渲染到DOM 中两个组件的模板内容的总和,在这种情况下它只是一个span元素:
<span>Hello World<span>
Run Code Online (Sandbox Code Playgroud)
是否可以像下面的代码片段那样在 DOM 中实现渲染输出,这样自定义元素的模板在 DOM 中由保留其标签名称的标签表示?
<component-b>
<component-a>
<span>Hello World</span>
</component-a>
</component-b>
Run Code Online (Sandbox Code Playgroud) 我尝试创建一个简单的汇总应用程序配置,但在使用 css 时遇到了一些麻烦。
这是我的 css 文件:
@import "normalize.css";
@import "typeface-roboto";
html, body, #root {
height: 100%;
font-family: Roboto, serif;
}
body {
background: url('./images/background.jpg');
}
Run Code Online (Sandbox Code Playgroud)
我所拥有的只是关于未找到资源的 3 个错误。
这是我的配置文件:
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import babel from 'rollup-plugin-babel'
import replace from 'rollup-plugin-replace'
import postcss from 'rollup-plugin-postcss'
import html from 'rollup-plugin-fill-html'
import url from "rollup-plugin-url"
process.env.NODE_ENV = 'development'
const CWD = process.cwd()
const Paths = {
SRC: `${CWD}/src`,
DIST: `${CWD}/dist-rollup`,
NODE_MODULES: `${CWD}/node_modules`
}
Object.assign(Paths, {
INPUT: Paths.SRC + …Run Code Online (Sandbox Code Playgroud) 有没有一种简单的方法可以从另一个索引的聚合结果中创建一个新索引(也许可以合并它们).
我有一个大型索引,产品类似.他们有一个产品ID来识别哪些产品属于一起,但他们有不同的URL /价格和不同的标题(我想在合并中以某种方式保存,以便我可以搜索它).
因此,如果我输入8个产品系列,我很乐意将其全部汇总到1个带有类似产品数据的嵌套数组的产品中.
我尝试使用以下作业的汇总API.但我无法按照我想要的方式进行,我感觉这只是历史/日志数据.我的所有数据都是一样的,timestamp因为我每天早上更新所有这些数据.
PUT _xpack/rollup/job/product
{
"index_pattern": "products",
"rollup_index": "products_rollup",
"cron": "*/30 * * * * ?",
"page_size": 1000,
"groups": {
"date_histogram": {
"field": "timestamp",
"interval": "7d"
},
"terms": {
"fields": [
"product_id"
]
}
},
"metrics": [
{
"field": "total_price",
"metrics": [
"min",
"max",
"sum"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
使用汇总,我试图捆绑一个 typescript 库,该库导入和调用包含 wasm 文件的 npm 模块。
只有生成的包不包含 wasm 文件内容的痕迹。我怎样才能强制它也捆绑 webassembly?
这是我尝试过的关键文件:
// typescript/src/index.ts
import * as libEd from "ed25519-raw";
export const seed_from_phrase = libEd.seed_from_phrase;
export const gen_keypair = libEd.gen_keypair;
Run Code Online (Sandbox Code Playgroud)
我的 package.json 是
{
"name": "ed25519",
"version": "0.1.0",
"description": "ed25519",
"main": "typescript/dist/bundle.cjs.js",
"types": "typescript/src/index.ts",
"dependencies": {
"ed25519-raw": "git+https://github.com/cmanteiga/ed25519-raw"
},
"devDependencies": {
"@types/node": "^13.7.1",
"typescript": "^3.7.5",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-multi-entry": "^3.0.0",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-wasm": "^3.0.0",
"rollup": "^1.31.1",
"rollup-plugin-typescript2": "^0.26.0"
}
}
Run Code Online (Sandbox Code Playgroud)
最后汇总配置是
{
"name": "ed25519",
"version": "0.1.0",
"description": "ed25519",
"main": "typescript/dist/bundle.cjs.js",
"types": …Run Code Online (Sandbox Code Playgroud) 我正在构建一个基于汇总的 UI 库。发生错误,我不知道如何解决。
TypeError: Cannot read properties of undefined (reading 'scoped')
at transformStyle (C:\my-kit\node_modules\@vitejs\plugin-vue\dist\index.js:4597:19)
at Object.transform (C:\my-kit\node_modules\@vitejs\plugin-vue\dist\index.js:4747:18)
at C:\my-kit\node_modules\rollup\dist\shared\rollup.js:22870:37 {
code: 'PLUGIN_ERROR',
plugin: 'commonjs--resolver',
hook: 'resolveId',
id: 'C:\\my-kit\\packages\\my-ui\\icon\\select-icon-svg.vue?vue&type=style&index=0&scoped=true&lang.less',
Run Code Online (Sandbox Code Playgroud)
看起来解析 vue 有问题。
const 块=描述符.styles[索引];
的值block未定义,访问scoped的属性时发生错误block。
这是我的汇总配置。希望有人可以帮助我。
import { rollup } from "rollup";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import fastGlob from "fast-glob";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import css from "rollup-plugin-css-only";
import commonjs from "@rollup/plugin-commonjs";
import esbuild from "rollup-plugin-esbuild";
import postcss from …Run Code Online (Sandbox Code Playgroud) 问题 :
\n这是我使用 React/Vite 应用程序运行构建时发生的情况:
\nvite v2.9.6 building for production...\n\xe2\x9c\x93 1 modules transformed.\n\nERROR [vite]: Rollup failed to resolve import "src/bootstrap.tsx" from "index.html".\nThis is most likely unintended because it can break your application at runtime.\nIf you do want to externalize this module explicitly add it to \n`build.rollupOptions.external`\nRun Code Online (Sandbox Code Playgroud)\n预期结果:构建成功。
\n在开发模式下一切正常。
\n我尝试了什么:
\n这里有一个解决方案,建议将“/”添加到index.html中脚本的路径中,但在我的代码中已经是这种情况,并且它不起作用。我仍然尝试不使用“/”,以防万一。
\n我的一些代码:
\n在index.html中:
\n<script type="module" src="/src/bootstrap.tsx"></script>\nRun Code Online (Sandbox Code Playgroud)\n在 vite.config.ts 中:
\nimport { defineConfig, loadEnv } from \'vite\';\nimport react from …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Rollup 设置 React 组件库,但每次我尝试使用 构建应用程序时rollup -c,都会收到以下错误:`
[!] TypeError: dts is not a function
TypeError: dts is not a function
at Object.<anonymous> (D:\xyz\rollup.config.js:32:15)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at ESMLoader.import (node:internal/modules/esm/loader:530:24)
at importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
Run Code Online (Sandbox Code Playgroud)
这是我的文件:
rollup.config.js
const resolve = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const typescript = require('@rollup/plugin-typescript')
const dts = require('rollup-plugin-dts')
const packageJson = require('./package.json')
module.exports = [
{ …Run Code Online (Sandbox Code Playgroud) "jsx": "react-jsx",我在 tsconfig 文件中使用并使用 Vite/rollup 进行捆绑。由于某种原因,即使 NODE_ENV 设置为生产环境,我的模块始终与react-jsx-runtime.production.min.js和捆绑在一起。react-jsx-runtime.development.js我只希望包含生产代码。
我可以通过'react/jsx-runtime'在汇总选项中设置为 external 来删除这两个选项,但这也不是我想要的产品包。我找不到解释这一点的文档。有谁知道如何阻止捆绑程序包含开发运行时?
vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
build: {
lib: {
entry: './src/index.tsx',
formats: ['es'],
name: `button`,
fileName: `button`,
},
rollupOptions: {
external: ['react'],
},
},
plugins: [react()],
})
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext", …Run Code Online (Sandbox Code Playgroud) 我正在使用 Vite 构建一个 React 应用程序,该应用程序托管在我的网络服务器上的子目录 ( /pwa) 中。
主要站点是 Drupal 10 站点。
之前,我使用 Create React App 来构建我的 PWA。我现在已将 PWA 转换为使用 Vite,但问题是,当我运行npm run build并将dist目录复制到/pwa我的服务器上时,查找资产失败,因为构建目标www.example.com/assets而不是www.example.com/pwa/assets.
如何修改 vite 配置以告诉它我需要最终输出来查找子目录中的资产?
rollup ×10
vite ×4
typescript ×3
reactjs ×2
angular ×1
build ×1
css ×1
import ×1
ionic2 ×1
javascript ×1
package.json ×1
rollupjs ×1
vue.js ×1
vuejs2 ×1
vuejs3 ×1
wasm-bindgen ×1
webassembly ×1