diff --git a/lib/builder/webpack/base.config.js b/lib/builder/webpack/base.config.js index bc12f57a12..bca749c1cd 100644 --- a/lib/builder/webpack/base.config.js +++ b/lib/builder/webpack/base.config.js @@ -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 }) diff --git a/test/basic.ssr.test.js b/test/basic.ssr.test.js index 64657f1158..45d0d230fc 100755 --- a/test/basic.ssr.test.js +++ b/test/basic.ssr.test.js @@ -306,6 +306,11 @@ test('/jsx', async t => { t.true(html.includes('

JSX Page

')) }) +test('/jsx-link', async t => { + const { html } = await nuxt.renderRoute('/jsx-link') + t.true(html.includes('

JSX Link Page

')) +}) + test('/js-link', async t => { const { html } = await nuxt.renderRoute('/js-link') t.true(html.includes('

vue file is first-class

')) diff --git a/test/fixtures/basic/pages/jsx-link.js b/test/fixtures/basic/pages/jsx-link.js new file mode 100644 index 0000000000..58424174c3 --- /dev/null +++ b/test/fixtures/basic/pages/jsx-link.js @@ -0,0 +1,5 @@ +import renderLink from './jsx-link.jsx' + +export default { + render: renderLink +} diff --git a/test/fixtures/basic/pages/jsx-link.jsx b/test/fixtures/basic/pages/jsx-link.jsx new file mode 100644 index 0000000000..e36e7df03b --- /dev/null +++ b/test/fixtures/basic/pages/jsx-link.jsx @@ -0,0 +1,5 @@ +export default function (h) { + return (
+

JSX Link Page

+
) +}