diff --git a/src/transforms/babel.js b/src/transforms/babel.js index 0a09df25f83..d8ff0e1d88c 100644 --- a/src/transforms/babel.js +++ b/src/transforms/babel.js @@ -22,7 +22,8 @@ const JSX_EXTENSIONS = { const JSX_PRAGMA = { react: 'React.createElement', preact: 'h', - nervjs: 'Nerv.createElement' + nervjs: 'Nerv.createElement', + hyperapp: 'h' }; async function babelTransform(asset) { diff --git a/test/integration/jsx-hyperapp/index.js b/test/integration/jsx-hyperapp/index.js new file mode 100644 index 00000000000..8d097d55d7f --- /dev/null +++ b/test/integration/jsx-hyperapp/index.js @@ -0,0 +1 @@ +module.exports =
; diff --git a/test/integration/jsx-hyperapp/package.json b/test/integration/jsx-hyperapp/package.json new file mode 100644 index 00000000000..c333e4a1bd7 --- /dev/null +++ b/test/integration/jsx-hyperapp/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "hyperapp": "*" + } +} diff --git a/test/javascript.js b/test/javascript.js index e394ba47407..efbce432b8d 100644 --- a/test/javascript.js +++ b/test/javascript.js @@ -683,6 +683,13 @@ describe('javascript', function() { let file = fs.readFileSync(__dirname + '/dist/index.js', 'utf8'); assert(file.includes('Nerv.createElement("div"')); }); + + it('should support compiling JSX in JS files with Hyperapp dependency', async function() { + await bundle(__dirname + '/integration/jsx-hyperapp/index.js'); + + let file = fs.readFileSync(__dirname + '/dist/index.js', 'utf8'); + assert(file.includes('h("div"')); + }); it('should support optional dependencies in try...catch blocks', async function() { let b = await bundle(__dirname + '/integration/optional-dep/index.js');