0
votes

So after following the guide on the webpack website and following along with Petr's video here: https://www.youtube.com/watch?v=JdGnYNtuEtE I have the following webpack.config.js file:

var webpack = require('webpack');

module.exports = {
  entry: './src/app.js',
  output: {
    filename: './dist/bundle.js'
  },
  devServer: {
    inline:true,
    port: 8081
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
    },
    extensions: ['*', '.js', '.vue', '.json']
  },
  module: {
    rules: [
      {
            test: /\.vue$/,
            loader: 'vue-loader'
        },
        {
            test: /\.js$/, // /\.esm.js$/
            loader: "babel-loader",
            exclude: /node_modules/
        },
      {
      test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 8192
            }
          }
        ]
      },
      {
        test: /\.(css|less)$/,
        use: [
          {
              loader: "style-loader"
          }, {
              loader: "css-loader"
          }, {
              loader: "less-loader"
          }
        ]
      },
      {
        test: /\.(woff|woff2|eot|ttf|svg)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 100000
            }
          }
        ]
      }
    ]
  }
}

It has come to the production stage of my app, and only the bundle.js file and index.html file exist in the dist folder. This works as it grabs the resources from "../src/assets/" folder, however I expect that it should create and copy the assets to an assets folder in the /dist/ folder.

If anyone can help me with what I am doing wrong in the config I would greatly appreciate it!

1

1 Answers

0
votes

As you are using the devServer option, no files will be written on disk.

devServer: {
  inline:true,
  port: 8081
},

The web server will work on port 8081 and the generated files will be in memory.