Javascript 反应JSX+;二氧化钛
我们目前的基础设施依赖钛作为天然材料。我正在尝试使用将我的节点项目转换为CommonJS。但是,它在JSX上失败:Javascript 反应JSX+;二氧化钛,javascript,reactjs,gruntjs,react-jsx,grunt-browserify,Javascript,Reactjs,Gruntjs,React Jsx,Grunt Browserify,我们目前的基础设施依赖钛作为天然材料。我正在尝试使用将我的节点项目转换为CommonJS。但是,它在JSX上失败: return ( <div className="App"> <EnergyChart width="1000" data={JSONData.data} customerID={customerID} lineColor='#FF0' height="500" marginTop="20" marginLeft="50" marginBottom="
return (
<div className="App">
<EnergyChart width="1000" data={JSONData.data} customerID={customerID} lineColor='#FF0' height="500" marginTop="20" marginLeft="50" marginBottom="20" marginRight="20" />
</div>
);
对于titaniumifier,我有以下几点:
"titaniumifier": {
"module": {
files: {
// The package is in "." and the zipfile will be written in "."
".": "."
},
},
options: {
transform: [ require('grunt-react').browserify],
}
}
但是运行grunt titaniumifier:module
返回
致命错误:正在分析文件
/Users/rduckworth/Projects/titanium-d3/app/app.js:意外令牌
(23:6)
这是上面的JSX代码
我能让Titaniumifier像browserify那样编译JSX吗?@rickyduck的创建者和维护者。很抱歉我错过了这个问题 通过为应用程序启用Babel Transfilation,您可以为包/模块启用Babel Transfilation 长话短说:
titaniumifier.transforms
对象{
"devDependencies": { ".." },
"titaniumifier": {
"transforms": {
"babel": { "presets": [ "es2015" ] }
}
}
}
{
"devDependencies": { ".." },
"titaniumifier": {
"transforms": {
"babel": { "presets": [ "es2015" ] }
}
}
}