Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vue-loader 15.0 usage
// This requires the WIP branch at https://github.com/vuejs/vue-loader/tree/next
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './main.js'),
output: {
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
// this will apply to both plain .js files
// AND <script> blocks in vue files
{
test: /\.js$/,
loader: 'babel-loader'
},
// this will apply to both plain .css files
// AND <style> blocks in vue files
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
// this will apply to both plain .scss files
// AND <style lang="scss"> blocks in vue files
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
data: '$color: red;'
}
}
]
}
]
},
plugins: [
// make sure to include the plugin for the magic
new VueLoaderPlugin()
]
}
@cloudfroster

This comment has been minimized.

Copy link

@cloudfroster cloudfroster commented Mar 20, 2018

i like it -_-

@MelMacaluso

This comment has been minimized.

Copy link

@MelMacaluso MelMacaluso commented Nov 7, 2018

Should have read the breaking changes for vue-loader 15...thanks thought 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment