-
Notifications
You must be signed in to change notification settings - Fork 71
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
TS 3.8 private fields breaks build -- update to Rollup v2.4.0+ #217
Comments
This is rollup complaining that it can't parse JS the plugin produces, here is a workaround I think: rollup/rollup#3128 |
I've tried rollup/rollup#3128 (comment) Rollup.config.js import acornPrivateFields from 'acorn-private-class-elements'
import typescript from 'rollup-plugin-typescript2'
import pkg from './package.json'
let defaults = { compilerOptions: { declaration: true } };
let override = { compilerOptions: { declaration: false } };
export default {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
},
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
acornInjectPlugins: [
acornPrivateFields()
],
plugins: [
typescript({
tsconfigDefaults: defaults,
tsconfig: "tsconfig.json",
tsconfigOverride: override,
// verbosity: 3,
})
],
} output
|
Did you import |
Tried the same, same error. Here's my config: import acornClassFields from "acorn-class-fields"
import acornClassElements from "acorn-private-class-elements"
import acornStaticClassFeatures from "acorn-static-class-features"
import acornPrivateMethods from "acorn-private-methods"
export default {
input: ['src/ext/src/bg/background.js'],//, 'src/ext/src/browser_action/main.js'],
output: {
dir: 'dist/ext/src/bg',
//file: 'ext/src/bg/background-dist.js',
format: 'es',
plugins: []
},
acornInjectPlugins: [
acornClassFields(), I get
|
@ezolenko yes, it's in rollup.config.js, just forgot to add one more new line in formatting 💇♂ I've also tried yesterday https://www.npmjs.com/package/@rollup/plugin-typescript Had a different error, but at least it knows it's private but when I moved target from es5 anything higher, it's # is again unknown. To me, it looks like missing parser or some helper? |
@ezolenko @0biWanKenobi may this could be issue? acornjs/acorn-private-class-elements#10 |
@yangwao that is another issue I'm having and I commented there too. In this case the error is that we don't need parenthesis when configuring rollup, so: acornInjectPlugins: [
acornClassFields
] is the way to go. Still getting # marked as an error, tho.. but that's another story |
I believe Rollup was updated to support ES private fields in v2.4.0 / rollup/rollup#3488, so this is no longer an issue. That release also roughly coincides with the timing that comments on this stopped. It was also upstream in Rollup, so not something this plugin can fix on its own. Closing as resolved upstream. |
What happens and why it is wrong
When I've upgraded code to use private fields, at build I get
Error: Unexpected character '#' (Note that you need plugins to import files that are not JavaScript)
Learn more here
It just doesn't know '#', like there is no support for that?
I'm just curious, otherwise, I would receive some error.
Heads up and thanks for any hint or suggestion!
Environment
typescript 3.8.3,
tslint 5.20.1
Versions
rollup.config.js
tsconfig.json
package.json
plugin output with verbosity 3
log
The text was updated successfully, but these errors were encountered: