我正在学习Webpack并一次又一次地学习它.在最新版本中,有一些非常奇怪的事情发生.CLI报告一切都很好和输出文件dress_aphrodite.js
的emitted
,但其无处文件夹中找到.
以下是日志:来自CLI:
http://localhost:8080/webpack-dev-server/ webpack result is served from /app/ content is served from ./app Hash: 5334867c12acfa65ba90 Version: webpack 1.12.9 Time: 1966ms Asset Size Chunks Chunk Names dress_aphrodite.js 390 kB 0 [emitted] main dress_aphrodite.js.map 479 kB 0 [emitted] main chunk {0} dress_aphrodite.js, dress_aphrodite.js.map (main) 354 kB [rendered] [0] multi main 52 bytes {0} [built] [1] ./~/babel-polyfill/lib/index.js 209 bytes {0} [built] [2] ./~/core-js/shim.js 4.31 kB {0} [built] [3] ./~/core-js/modules/es5.js 10.2 kB {0} [built] ... [263] ./~/ansi-regex/index.js 135 bytes {0} [built] webpack: bundle is now VALID.
所以一切看起来都不错.但是,dress_aphrodite.js
主文件夹或./app
文件夹中没有文件.
这是webpack.config.js文件:
var path = require ('path'); var webpack = require ('webpack'); module.exports = { entry : [ 'babel-polyfill', './app/da', 'webpack-dev-server/client?http://localhost:8080' ], resolve : { extension : ['', '.js', '.jsx', '.json'] }, output : { publicPath : '/app/', filename : 'dress_aphrodite.js' }, debug : true, devtool : 'source-map', devServer : { contentBase : './app' }, module: { loaders: [ { test : /\.js$/, include : path.join (__dirname, 'app'), loader : 'babel-loader', query : { presets : ["es2015"] } } ] } };
最后,任何人都需要package.json文件,这里是:
{ "name": "dress_aphrodite", "version": "1.0.0", "description": "", "main": "dress_aphrodite.js", "scripts": { "start": "node_modules/webpack-dev-server/bin/webpack-dev-server.js" }, "author": "", "license": "ISC" }
有关输出文件未被发出/呈现的原因的任何帮助?
谢谢
编辑:尝试没有Output.publicPath
(如YuWu建议),仍然没有变化.将其更改为path
属性并且仍然没有变化.
编辑2:作为测试,我将文件添加html-webpack-plugin
到webpack.config.js
文件中以查看它是否会被webpack发出,是的,显然已经发出了但是我看不到.
编辑3 :(与YuWu发表慷慨的对话):webpack-dev-server
运行正常并在js文件中显示window.alert以及通过创建的动态html文件html-webpack-plugin
.我记得webpack-dev-server
全球安装.这可能是存储html和js发出的文件的地方吗?我在哪里可以找到Ubuntu 15.1中的全局目录?(不应该是这样的情况,因为package.json指向引用'start'属性的本地目录路径...)
编辑4:这是我在webpack github问题部分发布的问题.我的进一步调查结果也在评论中注明. https://github.com/webpack/webpack/issues/1736