我有一个带有一些翻译的YAML文件。我需要将这些文件转换为JSON文件。我尝试使用yaml-import-loader,json-loader但出现错误。
这是我的设置:
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractEnglish = new ExtractTextPlugin('lang/en.js');
module.exports = {
entry: [
'./src/locales/application.en.yml',
],
output: {
filename: 'english.js',
},
module: {
strictExportPresence: true,
rules: [
{
test: /\.en\.yml$/,
use: extractEnglish.extract({
use: [
// { loader: 'json-loader' },
{
loader: 'yaml-import-loader',
options: {
output: 'json',
},
}],
}),
},
],
},
plugins: [
extractEnglish,
],
};
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
Users/xxx/Documents/Project/node_modules/extract-text-webpack-plugin/dist/index.js:188
chunk.sortModules();
^
TypeError: chunk.sortModules is not a function
at /Users/xxx/Documents/Project/node_modules/extract-text-webpack-plugin/dist/index.js:188:19
Run Code Online (Sandbox Code Playgroud)
不论是否json-loader评论,都会出现相同的错误。
我真的不明白怎么了。
版本:“ …
我刚刚被分配了一个完全用jQuery制作的网站.它异步加载几页,并希望成为SPA.
现在唯一的事情是开发人员一般不考虑URL,人们无法通过www.example.com以任何其他方式访问网站
我知道AngularJS,我的问题是: - 是否值得集成AngularJS来管理路由,这样我就不必通过jQuery并检查每一次点击,然后每个链接?
谢谢
如果我尝试将proptype设置为PropTypes.element,而不是必需的,那么正确的默认值是什么?
static propTypes = {
expandable: PropTypes.bool,
popover: PropTypes.element,
}
static defaultProps = {
expandable: false,
popover: () => {},
}
Run Code Online (Sandbox Code Playgroud)
谢谢
只是想知道为什么我的路由器没有方法导航?
我已经new App.Router;打电话了.在我看来,我尝试调用我的索引视图:
addTrip: function(e){
e.preventDefault() ;
//Adding to collection
var newTrip = this.collection.create({
title: this.$('#new_trip #title').val(),
where: this.$('#new_trip #where').val(),
desc: this.$('#new_trip #desc').val(),
rating: this.$('#new_trip .active').text()
}, { wait: true }) ;
if(newTrip.validationError){
this.errorReport(newTrip.validationError) ;
}
this.clearForm() ;
//Navigate to home route
App.Router.navigate('', true) ;
}
Run Code Online (Sandbox Code Playgroud)
我在Chrome开发工具中收到以下错误:
Uncaught TypeError: Object function (){ return parent.apply(this, arguments); } has no method 'navigate'
我甚至试图从控制台调用导航,它似乎也没有工作.
我究竟做错了什么?
我知道这是一项简单的任务,但我似乎无法找到解决方案.
我有一个格式的日期:20/02/2013我只想更换/ by - 到目前为止我已经有了它但它只取代了第一个斜线...不知道为什么不是第二个:
date = 20/02/2013;
date.replace('/', '-');
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.