Skip to content
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

I think there must have a bug in the rollup when handling createRequire #4597

Open
CGQAQ opened this issue Aug 1, 2022 · 1 comment
Open

Comments

@CGQAQ
Copy link

CGQAQ commented Aug 1, 2022

Rollup Version

2.77.2

Operating System (or Browser)

chrome macos

Node Version (if applicable)

16.15.1

Link To Reproduction

https://github.com/CGQAQ/rollup-createRequire-reproduce

Expected Behaviour

either embedding that json directly OR createRequire based on that folder instead of '__dirname'

Actual Behaviour

just throw a __dirname to createRequire

@Tanimodori
Copy link

Tanimodori commented Mar 16, 2023

/node_modules/css-tree/lib/data-patch.js

import { createRequire } from 'module';

const require = createRequire(import.meta.url);
const patch = require('../data/patch.json');

export default patch;

createRequire is not (yet) supported by Rollup (incl. official plugins).

More on #4359 (comment), #4274

I'd suggest externalize it. The best you can try is to bundle using preserveModules, preserveEntrySignatures and copy those binaries on writeBundle. (See cawa-93/vite-electron-builder#904)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants