Skip to content

Instantly share code, notes, and snippets.

@yyx990803
Last active March 8, 2024 17:43
Show Gist options
  • Save yyx990803/e0f4f1275841f4ce756b8c1ac1db76e9 to your computer and use it in GitHub Desktop.
Save yyx990803/e0f4f1275841f4ce756b8c1ac1db76e9 to your computer and use it in GitHub Desktop.
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
Copy link

cloudfroster commented Mar 20, 2018

i like it -_-

@MelMacaluso
Copy link

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