var path = require('path') var sourceDir = path.resolve(__dirname, 'src'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './src/main.js', output: { // To the `dist` folder path: './dist', // With the filename `build.js` so it's dist/build.js filename: 'build.js' }, resolve: { extensions: ['', '.js', '.vue'], fallback: [path.join(__dirname, '../node_modules')], alias: { 'vue$': 'vue/dist/vue', 'src': path.resolve(__dirname, '../src'), 'assets': path.resolve(__dirname, '../src/assets'), 'components': path.resolve(__dirname, '../src/components') } }, resolveLoader: { fallback: [path.join(__dirname, '../node_modules')] }, module: { // Special compilation rules loaders: [ { // Ask webpack to check: If this file ends with .js, then apply some transforms test: /\.js$/, // Transform it with babel loader: 'babel', // don't transform node_modules folder (which don't need to be compiled) exclude: /node_modules/ }, { test: /\.vue$/, loader: 'vue' }, { test: /\.scss$/, loaders: ["style", "css", "sass"] }, { test: /\.png$/, loader: "url-loader?limit=100000" }, ] }, vue: { loaders: { js: 'babel' } }, plugins: [ new HtmlWebpackPlugin({ template: sourceDir + '/index.html' }) ] }