Skip to content

Instantly share code, notes, and snippets.

@crookse
Last active November 28, 2019 06:56
Show Gist options
  • Save crookse/c708376cb3d8ce426efe60cb5c6acfc3 to your computer and use it in GitHub Desktop.
Save crookse/c708376cb3d8ce426efe60cb5c6acfc3 to your computer and use it in GitHub Desktop.
Vue: Automate Your Routing - webpack.config.js
const webpack = require("webpack");
const path = require("path");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
module.exports = {
entry: path.resolve(__dirname, "assets/bundle.js"),
mode: "development",
output: {
path: path.resolve(__dirname, "assets/"),
filename: "bundle.compiled.js"
},
module: {
rules: [
// this will apply to both plain `.js` files AND `<script>` blocks in `.vue` files
{
test: /\.js$/,
loader: "babel-loader"
},
// this will apply to the `<template lang="pug">` blocks in `.vue` files
{
test: /\.pug$/,
loader: "pug-plain-loader"
},
// this will apply to `.vue` files
{
test: /\.vue$/,
loader: "vue-loader"
},
],
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
},
plugins: [
// make sure to include the plugin!
new VueLoaderPlugin(),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment