1,202 questions
-1
votes
1
answer
426
views
Merge a split chunk back into the entrypoint
I have a module with a good handful of chunks A, B, C, and D, all of which rely on a shared utilities file which Rollup separately chunks.
Because this utilities file is only a couple of Kb, and ...
0
votes
1
answer
107
views
backend dependency within Svelte component library gets imported on SvelteKit (Vite/Rollup) build
I created a Svelte component library which uses better-sqlite3 for some backend methods.
When building an app which uses this custom library, better-sqlite3 gets imported and bundled, causing issues ...
1
vote
0
answers
174
views
How to modify dynamically loaded <style> tags
I have a Vue ^2.7.15 application running on Vite ^4.5.0. When I run a dev server, <style> tags of each component are added into the <head> element, for example:
<style type="text/...
1
vote
1
answer
258
views
Vue 3 Router issue, no outlet, no displayed content
I have a vue3 application which works perfectly fine when embedding all packages in the directly (locally) in the output bundle.
package.json
"vue": "^3.4.29",
"vue-router&...
0
votes
0
answers
85
views
typescript: transform property to function call
Here's a minimal example of some typescript code:
// codebase.ts
console.log(document.body.shadowRoot);
console.log(document.body.childNodes);
It is proposed that we add the following functions:
// ...
0
votes
1
answer
637
views
Vite, Laravel and Vue.js - Error: Your current platform "undefined" and architecture "undefined"
Versions:
Node v20.14.0
npm 10.7.0
Laravel v10.17.0
I use Vite, Vue.js and Laravel. When I run "npm run dev" and I open up the browser, I get the following Javascript error in browser's ...
0
votes
0
answers
199
views
How to named export from CommonJS module with rollup?
I have the following src/infrastructure/db.ts file:
@injectable()
export class Database {
}
and src/infrastructure/index.ts:
import config from 'config';
export * from "./db"
This file is ...
2
votes
0
answers
209
views
RollupError: [type] is not exported by [file]
I followed this guide to make a UI library: https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma
When I try to build i get this error on my interfaces: ...
0
votes
0
answers
532
views
Getting error Uncaught TypeError: Cannot read properties of null (reading 'isCE') with rollup
I migrated my vue app from v2 to v3 and now when I use a component with slots then it gives error,
Uncaught TypeError: Cannot read properties of null (reading 'isCE')
But if I remove slots then it ...
1
vote
0
answers
40
views
Why is rollup using `import('u'+'rl')` instead of just putting `import('url')` in the generated JS output?
I have an application that uses rollup to convert an ESM codebase to CJS before compiling it as a pkg.exe file. The issue with this is that pkg does not allow dynamic imports, which is fine by me as ...
1
vote
1
answer
777
views
Adding Nitro Rollup config options breaks build process in Nuxt app
I'm using Nuxt and I needed to compile a couple specific .ts files into modules to be run. I've added the following into the nuxt.config.ts file:
nitro: {
rollupConfig: {
input: ['./server/...
1
vote
0
answers
108
views
How could I generate a bundle with external type declaration merging?
I'm trying to generate a bundled type with declartion merging, but the result doesn't matches my expectation.
For example, here's a simplified code:
import type { JSONSchema7 } from "json-schema&...
0
votes
1
answer
801
views
Using vite / rollup with npm workspaces, issue with react on production build
I am trying to create a local shared folder / workspace / package to share code between projects in a monorepo using npm workspaces, and it works in vite dev mode, but not when I build and preview ...
0
votes
1
answer
1k
views
Vite multi page (HTML) and Tanstack Router
I'm working on a project that I'll need create 3 HTML files, and they will share the same JS source. The main reason is that I need 2 differents manifest files for each HTML, it will be a PWA ...
0
votes
0
answers
200
views
Is it possible to roll-up rollupjs as a standalone module?
I'm trying to use Rollup to roll-up itself. The reason for this is that I need to integrate it into another app [a CLI built with vercel/pkg] as a standalone dependency.
In other words, I need to be ...
2
votes
1
answer
766
views
Getting Error during build: RollupError: expression expected after migrating from vue-cli to vite
I just migrated from vue-cli to vite. Serving locally works fine, but during the build, I got the following error:
x Build failed in 221ms
error during build:
RollupError: Expression expected
at ...
0
votes
1
answer
145
views
Rollup build empty index.js
I'm creating a simple component to publish on npm and using rollup to build. The issue is index.js has nothing but import 'react'
Here's rollup config
import typescript from '@rollup/plugin-typescript'...
1
vote
0
answers
899
views
How to fix Rollup.Js "Unresolved Dependency" for package that is in a yarn workspace
I have a yarn workspace with 2 packages in it. One is a react ts component library, and one is a types package. The component library uses the types library. When I build my component library using ...
1
vote
0
answers
191
views
Bundle LESS into Single File using Rollup
I have a React component that is bundled using Rollup.js. This library also includes styling written in LESS. I am already able to create a single compiled CSS file from that using the PostCSS plugin.
...
1
vote
0
answers
77
views
bundle[hash].js returning HTML - Uncaught SyntaxError: Unexpected token '<'
New to Java so appologies if this is a dumb question> I am trying to deploy my webpage on Vercel and it is building sucessfully however whenever I visit the webpage I get
Uncaught SyntaxError: ...
1
vote
0
answers
333
views
How to bundle tailwind css styles into rollup
I am using tailwind css along with clsx , class variance authority and tailwind-merge to create a button component. I am using storybook to test these components and the style works in storybook. When ...
3
votes
1
answer
2k
views
Bundle library with externalized dependencies and Vite?
I'm trying to publish a library to npm that uses type: "module". I'm using vite's library mode with the following config:
export default defineConfig({
css: {
postcss: {
plugins: ...
-1
votes
2
answers
3k
views
How to Precompile Vue 3 Components using Vite and Use Them as JS Module in Static HTML?
I'm currently exploring Vue 3 with Vite for a project, and I'm aiming to optimize the loading time of my web application. My strategy involves precompiling Vue components and using them as JavaScript ...
0
votes
1
answer
1k
views
Can I use Vite/Rollup to just transpile to cjs/esm without bundling?
I'm looking to use Vite/Rollup to just transpile files from .ts/tsx to .cjs or .mjs files without bundling everything into one big file.
I know that it's the point of Rollup to roll everything up into ...
1
vote
0
answers
132
views
React NPM library with rollup won't work when using dependencies and linking locally
I'm quite new to making NPM libraries and using Rollup.
I have the following rollup.config.js:
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { nodeResolve } from &...
1
vote
0
answers
6k
views
Vite Build Configuration to generate minified files
I am developing a vite-vue application.
vite build command minifies the ts and css/scss and places them in dist/main-xxxxxx.js and dist/main-xxxxxx.css and correctly linked with dist/index.html.
But ...
0
votes
1
answer
810
views
Use vue-i18n in a plugin library mode
Hello I'm developing a set of UI components using the library mode of vue3/rollup. Everything is build into a local npm package. The idea is to have a set of .vue files that can be used in several ...
0
votes
1
answer
575
views
Custom Vite plugin for transforming SVGs only works in development mode, not in build mode
I'm building an app with SvelteKit, which uses Vite for bundling.
I made a Vite plugin for importing SVG files (using the ?resource query after the file name) which parses the SVG file and turns it ...
1
vote
1
answer
600
views
Rollup component "Invalid hook call" after being built, and imported in another React project
I'm having some weird issues here with Rollup. If anyone is more-versed than I am, please, any help would be appreciated!
First off, I need to say that I see some similar issues here:
Creating react ...
0
votes
0
answers
477
views
How to remove comments from sourcemap created with Rollup and terser for web app javascript bundle?
How can I configure Rollup and it's terser plugin to create a sourcemap for my web app's minified javascript bundle, that doesn't have any of my javascript source code comments? I am using terser to ...
0
votes
0
answers
144
views
Preact: Generate "No build tools route" like code from buildtools
Currently I'm experimenting with Preact, Rollup and Typescript.
The idea is to create a sort of components library where all the dependencies are coming from CDN.
The idea is to have e.g. this product....
0
votes
1
answer
2k
views
Constant asset filenames with hashes in manifest file in ViteJS
I need to bundle JS/CSS files with ViteJS. Generated file names must be constant but I need hashes for those files in manifest file.
Sample folder structure:
/public/build/js/app.js
/public/build/css/...
6
votes
4
answers
8k
views
Getting `RollupError: Expression expected` when building NPM package
After that I finished the preparation of my environment to build my first NPM package for React JS with ROLLUP bundler I got RollupError: Expression expected as shown in below
Error output
> rollup ...
0
votes
0
answers
28
views
Issue in creating Library in React
I am not sure what is issue in this library but this library is not working.
Code is working fine in library it self but if I am using it in main app then nothing works.
Please let me know if any ...
2
votes
0
answers
515
views
How to get input key in transform or transformIndexHtml in Vite or Rollup?
I want to make a Vite plugin for file routers. I can't find the specific plugin in Awesome Vite and Rollup Awesome. Or maybe I am too lazy to curated one-by-one.
My problem is Rollup Input can give a ...
1
vote
0
answers
59
views
Undefined Window Error in Webpack-bundled React App
I've created a React component library called prism which I use in a React web app called beacon. prism is bundled using rollup, whereas beacon is bundled using webpack.
When I use the web app I'm ...
1
vote
0
answers
1k
views
Vite rollupOptions and Typescript
I have a typescript file in which I define and export a js class like so :
export class Hello {
constructor() {
console.log('hello');
}
}
I import this class in a <script type=&...
-1
votes
1
answer
115
views
NPM package helmet version "7.1.0" rollup error
[!] RollupError: Expected ';', '}' or <eof> (Note that you need plugins to import files that are not JavaScript)
../../node_modules/helmet/index.d.cts (3:5)
1: import {IncomingMessage, ...
0
votes
1
answer
1k
views
Vitest (v1.1.2) throws errors
After upgrading vitest to latest version (1.1.2) from v0.33.0 for my React project, I'm seeing the following errors when running tests
Error: Expected ';', '}' or <eof>
❯ error node_modules/...
0
votes
1
answer
623
views
TypeError: hostOrText.readFile is not a function
I am trying to use npm rollup to make my repo into a npm module but I keep running into this error:
[!] (plugin commonjs--resolver) TypeError: hostOrText.readFile is not a function
at ...
0
votes
0
answers
219
views
Building a Design System with React Native Web and React Native using Expo-Vector-Icons
I am in the process of developing a design system using React Native Web and React Native as an npm package. While I've made progress in getting all the expo-vector-icon related components to work on ...
2
votes
0
answers
840
views
How to configure rollup js to bundle node modules commonJs
I have a simple ts application that I run in the browser.
To bundle the ts files I am using rollup js.
I installed diffusion package
npm install diffusion
And import the module to my ts file app.ts:
...
2
votes
0
answers
667
views
How to prevent files, assets, folders,being bundled by rollup?
I am using vite to build a component library, I have some set of folders inside src/components and some folders inside the public that needs to be ignored from the rollup output bundle. I cant find an ...
0
votes
1
answer
216
views
function name not available in production build in vite global import
I'm using vite global import feature to register some functions in globalProperties in vue 3 app to achive global $filters array in main.ts.
It works propely in development time but after production ...
2
votes
0
answers
448
views
Nx publishable library: 'rootDir' is expected to contain all source files after running build
I created a publishable Nx library that has a project.json like this (only build target):
{
"name": "@pace-io/myLib",
"$schema": "../../node_modules/nx/schemas/...
1
vote
0
answers
818
views
Rollup transform of file including sourcemap for vite?
I am attempting to create Rollup plugin to use in my Vite build which will transform a file dynamically during build. Using transform(code: string, id: string) the transformation works as expected. ...
18
votes
9
answers
51k
views
Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies
I am facing an error while running the server after creating a vite application please help me resolve this.
I was learning threejs and just created a vite application with vanilla framework and ...
1
vote
0
answers
509
views
Vue 3 CDN : can't include third party component library also from a CDN
I published a Vue 3 components library (using Vite), which works fine when imported as a package in a Vue application. However some conflicts appear when both Vue and the library are included via CDN.
...
0
votes
0
answers
2k
views
Vue.js app on Vite cannot import a local module. "Uncaught SyntaxError: The requested module does not provide an export named 'Plugin' (at main.js)"
I'm building a local Vue.js component library module, as well as a separate Vite + Vue.js app which consumes this library.
As info, the library plugins are produced with Rollup.js and the app is ...
0
votes
2
answers
858
views
How can I set global / environment variables to my own npm package / node module from a project?
I have made my own npm package for react. We will call it @group/package
In that package, I made exportable hooks.
As an example, I made a hook that we will call useFetchWithRefreshToken.
In that ...