Created
August 28, 2019 10:42
-
-
Save yurenju/9a9f64d498b763f5b9f90434299b88c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = ({ config, mode }) => { | |
// handle scss resource in vue file | |
const scssRule = { | |
test: /\.scss$/, | |
oneOf: [ | |
{ | |
resourceQuery: /\?vue/, | |
use: ["vue-style-loader", "css-loader", "postcss-loader", "sass-loader"] | |
} | |
] | |
}; | |
// Handle js resource | |
const jsRule = { | |
test: /\.js$/, | |
use: [{ loader: "babel-loader" }] | |
}; | |
// handle ts resource in vue file | |
const tsRule = { | |
test: /\.ts$/, | |
use: [ | |
{ loader: "babel-loader" }, | |
{ loader: "ts-loader" } | |
] | |
}; | |
config.module.rules.push(tsRule, jsRule, scssRule); | |
config.resolve.extensions.push(".ts"); | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment