mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
feat: transpile .jsx files
This commit is contained in:
parent
29768e597a
commit
eb9e4a529c
@ -63,7 +63,7 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
|||||||
options: vueLoader.call(this, { isServer })
|
options: vueLoader.call(this, { isServer })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.jsx?$/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
options: this.getBabelOptions({ isServer })
|
options: this.getBabelOptions({ isServer })
|
||||||
|
@ -306,6 +306,11 @@ test('/jsx', async t => {
|
|||||||
t.true(html.includes('<h1>JSX Page</h1>'))
|
t.true(html.includes('<h1>JSX Page</h1>'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('/jsx-link', async t => {
|
||||||
|
const { html } = await nuxt.renderRoute('/jsx-link')
|
||||||
|
t.true(html.includes('<h1>JSX Link Page</h1>'))
|
||||||
|
})
|
||||||
|
|
||||||
test('/js-link', async t => {
|
test('/js-link', async t => {
|
||||||
const { html } = await nuxt.renderRoute('/js-link')
|
const { html } = await nuxt.renderRoute('/js-link')
|
||||||
t.true(html.includes('<h1>vue file is first-class</h1>'))
|
t.true(html.includes('<h1>vue file is first-class</h1>'))
|
||||||
|
5
test/fixtures/basic/pages/jsx-link.js
vendored
Normal file
5
test/fixtures/basic/pages/jsx-link.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import renderLink from './jsx-link.jsx'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
render: renderLink
|
||||||
|
}
|
5
test/fixtures/basic/pages/jsx-link.jsx
vendored
Normal file
5
test/fixtures/basic/pages/jsx-link.jsx
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default function (h) {
|
||||||
|
return (<div class='container'>
|
||||||
|
<h1>JSX Link Page</h1>
|
||||||
|
</div>)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user