0.1.0 • Published 5 years ago
vue-thread-loader v0.1.0
Installation
Install it using npm or yarn:
yarn add vue-thread-loader --dev
npm i vue-thread-loader --save-dev
Usage
vue-thread-loader exposes a single function which receives a configuration object. Pass this to your vue.config.js configureWebpack
option.
vue.config.js
const vueThreadLoader = require('vue-thread-loader');
module.exports = {
configureWebpack: vueThreadLoader({
silent: Boolean // Default: true -> Supress log
filter: Function // Default: null -> A function which reveices the rule / current env and returns a falsy value if this rule should be skipped
mode: String // Default: 'any' -> Gets be compared to NODE_ENV and decides where the thread-loader should be injected. Use 'all' to allow all.
})
}
Or use it in-line:
const vueThreadLoader = require('vue-thread-loader');
module.exports = {
configureWebpack(config) {
// Your other stuff
vueThreadLoader()(config);
}
}
Examples
No debug log of vueThreadLoader. thread-loader gets injected into every chain and on any NODE_ENV.
module.exports = {
configureWebpack: vueThreadLoader()
}
Print debug log of vueThreadLoader. thread-loader gets injected into every chain but only on production
mode.
module.exports = {
configureWebpack: vueThreadLoader({
mode: 'production',
silent: false
})
}
No debug log of vueThreadLoader. thread-loader gets only injected into the vue chain and production
mode.
module.exports = {
configureWebpack: vueThreadLoader({
mode: 'production',
filter(rule, env) {
return rule.test.toString().includes('vue')
}
})
}
0.1.0
5 years ago