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
Add JSX integration for Vue.js #553
Conversation
lib/loaders/babel.js
Outdated
module.exports = { | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reverting this to prevent conflicts with https://github.com/symfony/webpack-encore/pull/550/files#diff-35a173566334465c73f4aebaff4cc9eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Kocal,
Thank you for working on that, really good PR :)
@@ -936,11 +936,26 @@ class Encore { | |||
* options.preLoaders = { ... } | |||
* }); | |||
* | |||
* // or configure Encore-specific options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on when it will get merged we'll have to make sure those next lines will be part of the code block added here: https://github.com/symfony/webpack-encore/pull/550/files#diff-168726dbe96b3ce427e7fedce31bb0bcR1000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! This is wonderful! I read all the docs first (great job, very complete), then read the docs in index.js
and finally... realized that the actual implementation is almost no code! That's awesome!
This PR was squashed before being merged into the 3.4 branch (closes #11346). Discussion ---------- [Frontend] Add section for using JSX with Vue.js Hi :) This PR add a new section for using JSX with Vue.js: ```js Encore.useVueLoader(() => {}, { useJsx: true }); ``` We should not merge it before symfony/webpack-encore#553 is merged. Commits ------- 916ad73 [Frontend] Add section for using JSX with Vue.js
Will close #551.
Doc: symfony/symfony-docs#11346
This PR enable JSX support in Vue.js with the following code:
I've added inline documentation and some tests for:
enableVueLoader()
behavior (and validation)As proof of concept for styles, after adding
<link href="build/main.css" rel="stylesheet">
in generatedtesting.html
file:App.css
,App.scss
andApp.less
are applied globally correctlyHello.css
are applied correctly toHello.jsx
component only (import styles from './Hello.css?module'
)This is an example of generated `main.css` file
Some notes for the documentation:
@vue/babel-preset-jsx
and@babel/plugin-transform-react-jsx
<img src="./assets/image.png">
will not work, you should require it yourself like<img src={require("./assets.image.png")}/>
.