mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Merge pull request #2628 from clarkdo/babel_jsx
feat: transpile .jsx files
This commit is contained in:
commit
c8f6dfb958
@ -63,7 +63,7 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
options: vueLoader.call(this, { isServer })
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
test: /\.jsx?$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
options: this.getBabelOptions({ isServer })
|
||||
|
@ -306,6 +306,11 @@ test('/jsx', async t => {
|
||||
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 => {
|
||||
const { html } = await nuxt.renderRoute('/js-link')
|
||||
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