From 251dc5863ba360bf67d05dd5268eb6e0eacb801e Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 7 Apr 2019 15:38:02 +0200 Subject: [PATCH 1/3] Frontend: add section for using JSX with Vue.js --- frontend/encore/vuejs.rst | 112 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/frontend/encore/vuejs.rst b/frontend/encore/vuejs.rst index a79755b2ff7..96caa12ac9d 100644 --- a/frontend/encore/vuejs.rst +++ b/frontend/encore/vuejs.rst @@ -40,7 +40,119 @@ updated styles still requires a page refresh. See :doc:`/frontend/encore/dev-server` for more details. +JSX Support +----------- + +You can enable `JSX with Vue.js`_ by configuring the 2nd parameter of ``.enableVueLoader`` method: + +.. code-block:: diff + + // webpack.config.js + // ... + + Encore + // ... + .addEntry('main', './assets/main.js') + + - .enableVueLoader() + + .enableVueLoader(() => {}, { + + useJsx: true + + }) + ; + +Then restart Encore. When you do, it will give you a command you can run to +install any missing dependencies. After running that command and restarting +Encore, you're done! + +Your ``.jsx`` files will now be transformed through ``@vue/babel-preset-jsx``. + +Using styles +~~~~~~~~~~~~ + +You can't use ``