我有一个包含若干翻译的YAML文件,需要将其转换为JSON文件。我尝试使用
以下是我的设置:
无论是否注释掉
版本: "webpack": "2.6.1", "extract-text-webpack-plugin": "^3.0.0", "json-loader": "^0.5.7"
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,
],
};
我遇到的错误:
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
无论是否注释掉
json-loader
,都会出现相同的错误。我真的不明白出了什么问题。版本: "webpack": "2.6.1", "extract-text-webpack-plugin": "^3.0.0", "json-loader": "^0.5.7"
.en.yml
,.es.yml
等)都具有相同的键,但具有不同的值。 - Got The Fever Mediaextract-text-webpack-plugin
的一部分。所以你似乎在使用的模块中遇到了一个错误,应该将其报告为一个bug。除非插件开发人员之一出现,否则你不太可能在这里得到帮助。 - flyx