webpackwebpack-dev-serverwebpack-2

Webpack - no output file generated?


I have the following webpack config:

var path = require('path')
var webpack = require('webpack')


module.exports = {
   entry: {
      main: './scripts/app/main.js'
   },
  output: {
     path: path.resolve(__dirname, './scripts/app/bundle/'),
     publicPath: '/scripts/app/bundle/',
     filename: '[name].js'
  },
  ...

When i run the command npm run dev it shows that main.js has been emitted

When I browse to /scripts/app/bundle/main.js sure enough the file is loaded in the browser

But when i look inthe physical path there is no file - seems like its only in memory

This is what I have in package.json:

"scripts": {
  "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
  "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
 },

How do I generate a physical file.


Solution

  • webpack-dev-server does not generate files on disk -- only on memory. However you do have some options: