javascript - webpack-dev-server packaging does not report errors but does not generate files
高洛峰
高洛峰 2017-05-16 13:45:35
0
4
1188

var path = require('path');
module.exports = {
  entry: "./src/main.js",//入口文件
  output: {//打包输出的文件
    path: __dirname,
    filename: "./dist/bundle.js"
  },
  module: {
    loaders: [
      {
        test: path.join(__dirname, 'src'),
        loader: 'babel-loader',
        query: {
          presets: ['es2015']
        }
      }
    ]
  }
}
{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.24.1",
    "babel-loader": "^6.4.1",
    "webpack": "^2.4.1"
  }
}

There is no problem with packaging using the webpack command
No error is reported when using npm start to package, but the file is not packaged.
I need to execute webpack first to package the file and then execute npm start before hot loading updates

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(4)
给我你的怀抱

I misread the title as mentioned abovewebpack-dev-serverIt’s just a local file server. It only provides file services and not packaging services
Document https://github.com/webpack/we...
And webpack (https:// github.com/webpack/we...) are two things

阿神

webpack-dev-server不会生成文件的,只会在内存里,用webpackTry it

过去多啦不再A梦

webpack-dev-server --inline --progress --hot --watch-pol

左手右手慢动作

The files generated by webpack-dev-server will only be in memory

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template