Comments (11)
You do not need a Babel plugin, you need an acorn plugin, namely 'acorn-jsx'. This will make Rollup's parser acorn handle JSX tokens.
See https://rollupjs.org/guide/en/#acorninjectplugins which exactly describes your use-case.
from plugins.
from plugins.
I've solved the problem。
And added some Babel components
源码地址
from plugins.
I had the same problem,for vue tsx!
let SiderBox = class SiderBox extends Vue {
render() {
return (<div>haha</div>);
}
};
from plugins.
Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. 🍺
from plugins.
@zanona pleas try the solution posted by @bhabgs. Happy to reopen if that doesn't fit the bill.
from plugins.
Hi, @shellscape. Unfortunately I am not using babel.
from plugins.
Thanks @lukastaegert.
I just tested and it worked pretty well. Thanks.
Considering this, would it be sensible to say that the preserve
option on this plugin would only work when using it the way you suggested? It may be worth documenting it perhaps?
from plugins.
Definitely worth a docs update as it may help others with a similar use-case, PR welcome!
from plugins.
Is Acorn a last step of this plugin or a part of Rollup? I think it's the latter, so then shouldn't this only be necessary if you want to preserve JSX in the final output, but not if you want another plugin (e.g. babel) to compile it instead? The current text seems to suggest it's always required when jsx
is set to preserve
, while all I'm trying to achieve is have the raw JSX run through babel macros, then convert it to regular JS.
from plugins.
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
packages/virtual-list/src/virtual-list.tsx
还是会有这样的情况发生,这是为什么?
from plugins.
Related Issues (20)
- virtual plugin creates files that are ignored by any plugin that uses createFilter
- Parsing fails when a class property is named global HOT 1
- The node-resolve plugin seems to break Vue when the Vue app imports a lib and consumes a native web components.
- Adopt updated rollup-plugin-delete? HOT 2
- [@rollup/plugin-graphql] Processing GraphQL queries declared in template files
- Watch mode: multiple saves required for changes to be transpiled correctly HOT 1
- (Compilation) error RollupError: Expected '{', got 'interface' / token 'static' . Expected * for generator, private key, identifier or async HOT 2
- [@rollup/plugin-commonjs]: vulnerability in inflight
- [@rollup/plugin-commonjs]: Which Comes First?The Documentation Seems to Be Conflicting
- [@rollup/plugin-replace] Missing sourceMap option within Readme HOT 2
- (@rollup/plugin-typescript) Cannot import typescript file from parent folder (../script) without .ts file extension (../script.ts)
- [!] (plugin typescript) RollupError: [plugin typescript] @rollup/plugin-typescript: Path of Typescript compiler option 'outDir' must be located inside Rollup 'dir' option.
- [@rollup/plugin-typescript] Cannot resolve input filepath which is absolute path and begin with lower case drive letter on windows
- [@rollup/plugin-node-resolve] Allow fallbacks for dependencies with incorrect exports field on package.json
- @rollup/plugin-alias entries is not work when use customResolver HOT 1
- [@rollup/plugin-eslint] New flat config `eslint.config.js` is not recognized HOT 1
- [@rollup/plugin-esm-shim] Shim inserted incorrectly if source file has `import` in comment HOT 1
- [@rollup/plugin-node-resolve] confusion about what this plugin does HOT 2
- How to tell `--configPlugin` to use specific `tsconfig`? HOT 5
- [@rollup/plugin-node-resolve] resolving package.json exports/imports arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugins.