-
Notifications
You must be signed in to change notification settings - Fork 11
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
[bug] Rollup: Unexpected character '#' #18
Comments
What is your version of Node? These are private class fields & have been supported since Node 12.4 |
I got Node 16.x, so it's not the issue. Rollup seems to have some issues with the TC, even with AcornPrivateFields installed and loaded into the config.
// rollup.config.js
import commonjs from '@rollup/plugin-commonjs';
import injectProcessEnv from 'rollup-plugin-inject-process-env';
import json from '@rollup/plugin-json';
import nodeGlobals from 'rollup-plugin-node-globals'
import nodePolyfills from 'rollup-plugin-node-polyfills';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import typescript from '@rollup/plugin-typescript';
export default {
input: 'src/index.ts',
output: {
exports: 'named',
format: 'es',
file: 'dist/index.mjs',
sourcemap: true,
},
plugins: [
typescript(),
commonjs(),
json(),
injectProcessEnv({
CODE_VERSION: process.env.CODE_VERSION || 'dev',
}),
nodeResolve({ browser: true }),
nodePolyfills({ crypto: true }),
nodeGlobals({ process: true }),
terser(),
],
} I also tried to use {
"compilerOptions": {
"target": "esnext",
"lib": ["esnext"],
"downlevelIteration": true,
"moduleResolution": "node",
"outDir": "dist",
"esModuleInterop": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@cloudflare"
],
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
} |
Would DOG still function well if the private properties are dropped in favor of private typehinted properties? class Group {
// Before
#children;
// After
private children;
} |
The source isn't changing. It's a stable language feature. Rollup accepts the syntax just fine: see REPL It's another part of your toolchain. |
Node Globals Rollup plugin is 4-6 years old and is stuck on Currently, acorn is 8.x, which has support for all ES2022 features. 🤦🏼♂️ And given the fact that npm installs packages for other packages, there was no way to force acorn 8.x It was indeed my toolchain. Disabling |
Ah, nice find! I think you should only need |
Can't remember why I needed the Anyway, great package. It was easy to implement and wanted to build myself one, now we know who codes faster. 😄 |
Rollup throws this error:
It seems to be caused by hashtag-prefixed members in the class, in index.js:
Any idea how to make it work with Rollup? I can't seem to find a straightforward solution on Google too. The example from this repo is not bundling the worker through Webpack or Rollup.
The text was updated successfully, but these errors were encountered: