我想知道是否有人可以提供帮助,我正在尝试完成我的构建过程,目前使用babel转换es6> es5,在完成之后我想使用uglifyJS以仅使用NPM脚本递归缩小所有.js文件(否)请咕噜咕噜地喝.
我想要的;
我目前的设置;
我试过了:https://www.npmjs.com/package/recursive-uglifyjs和https://www.npmjs.com/package/uglifyjs-folder但是这些似乎都无法执行我需要的构建步骤
这是我的package.json脚本部分
"babel": "babel js_uncompiled --out-dir js_uncompiled/es5 --source-maps && npm run npm:uglify",
"build": "npm run babel",
"uglify": "recursive-uglifyjs js_uncompiled/es5"
Run Code Online (Sandbox Code Playgroud)
你可以在这里找到我的完整package.json的链接:http://pastebin.com/4UHZ1SGM
谢谢
我已经尝试了各种方法来让它发挥作用。我正在尝试从节点上的 API 请求 PDF,然后将其发送回最初调用它的客户端。
\n\n目前我只想在节点服务器上成功保存并查看 PDF。
\n\n问题是当我打开 PDF 文件时它总是空的(即使它的大小为 30kb)。
\n\n基本流程是这样的(删除了一些位,但下面的代码可以正常工作并返回 PDF)
\n\n// We pass through session ID\'s, request dates etc through in body\napp.post("/getPayslipURL", function(client_request, res) {\n\n // create request, which will simply pass on the data to the database (In order to get the NI number we need for the pay API)\n const NI_NUMBER_REQUEST = db_api.createRequestTemplate({\n body: JSON.stringify(client_request.body)\n });\n\n // Create a chain of HTTPS Requests, Starting with our call to the DB\n requestPromise(NI_NUMBER_REQUEST)\n .then((db_response) …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何在移动视图中以不同的方式呈现组件(我希望它在移动设备中显示在我的标题之前,但在其他情况下)
我现在的代码是
import React from 'react';
import NavigationBar from './NavigationBar';
import SiteHeader from './SiteHeader';
export default class App extends Component {
constructor(props) {
super(props);
let width = window.innerWidth;
if (width > 768) {
this.setState(renderComponent =
`<div className="container">
<NavigationBar />
<SiteHeader />
{this.props.children}
</div>`
);
} else {
this.setState(renderComponent =
`<div className="container">
<NavigationBar />
<SiteHeader />
{this.props.children}
</div>`
);
}
}
render() {
return (
{renderComponent}
);
}
}
Run Code Online (Sandbox Code Playgroud)
然而,这不起作用(组件未定义),我想我不能只将组件设置为字符串,但希望这是足够的信息,以正确的方式做任何建议
谢谢!