我使用的是节点v6.10.3。
config.json
{
" root":{ " src":" ./ src", " dest":" ./ static", " dist":" ./ dist" },
"任务":{ " browserSync":{ " port":4500, "打开":假, "服务器":{ " baseDir":" ./" } },
"static": {
"src": "src",
"dest": "static"
},
"js": {
"src": "js",
"dest": "static/js",
"entries": {
"app": ["./app.js"]
},
"extensions": ["js", "json"],
"babel": {
"presets": ["es2015", "stage-1"],
"plugins": []
},
"extractSharedJs": false
},
"css": {
"src": "scss",
"dest": "css",
"autoprefixer": {
"browsers": ["> 0%"]
},
"sass": {
"indentedSyntax": true,
"includePaths": [
"./node_modules/normalize.css"
]
},
"extensions": ["sass", "scss", "css"]
},
"html": {
"src": "templates",
"dest": "./",
"dataFile": "data/global.json",
"htmlmin": {
"collapseWhitespace": true
},
"extensions": ["html", "json", "tpl"],
"excludeFolders": ["layouts", "partials", "macros", "data", "components"]
},
"images": {
"src": "img",
"dest": "img",
"extensions": ["jpg", "png", "svg", "gif"]
},
"fonts": {
"src": "fonts",
"dest": "fonts",
"extensions": ["woff2", "woff", "eot", "ttf", "svg"]
},
"iconFont": {
"src": "svg-font",
"dest": "fonts",
"sassDest": "generated",
"extensions": ["woff2", "woff", "eot", "ttf", "svg"]
},
"svgsprites": {
"src": "svg",
"dest": ".",
"extensions": ["svg"]
},
"production" : {
"rev": true
},
"critical" : {
"src": "*.html",
"width": 1920,
"height": 1080
},
"favicon": {
"src": ".",
"name": "favicon.ico",
"dest": "."
}
} }
错误
> ./src/js/app.js中的错误 模块构建失败:TypeError:Path必须是字符串。收到undefined 在assertPath(path.js:7:11) at Object.dirname(path.js:695:5) 在C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:353:36 在C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:375:22 在Array.map(本机) 在OptionManager.resolvePresets(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:364:20) 在OptionManager.mergePresets(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:348:10) 在OptionManager.mergeOptions(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:307:14) 在C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:349:14 在C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:369:24 在Array.map(本机) 在OptionManager.resolvePresets(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:364:20) 在OptionManager.mergePresets(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:348:10) 在OptionManager.mergeOptions(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:307:14) 在OptionManager.init(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:465:10) 在File.initOptions(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ index.js:194:75) 在新文件(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ file \ index.js:123:22) 在Pipeline.transform(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-core \ lib \ transformation \ pipeline.js:45:16) 在transpile(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-loader \ index.js:14:22) at Object.module.exports(C:\ Users \ user \ Documents \ Projekty \ Project \ wp-content \ themes \ theme \ node_modules \ babel-loader \ index.js:88:12) @ multi app