2020-07-24 19:20:37 +08:00
|
|
|
var VueLoaderPlugin = require('vue-loader/dist/plugin');
|
2020-08-28 11:09:05 +08:00
|
|
|
const path = require('path')
|
2020-07-24 19:20:37 +08:00
|
|
|
|
|
|
|
function webpack(config) {
|
|
|
|
return {
|
|
|
|
...config,
|
|
|
|
plugins: [...config.plugins, new VueLoaderPlugin.default()],
|
|
|
|
module: {
|
|
|
|
...config.module,
|
|
|
|
rules: [
|
|
|
|
...config.module.rules,
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: require.resolve('vue-loader'),
|
|
|
|
options: {},
|
|
|
|
},
|
2020-08-28 11:09:05 +08:00
|
|
|
{
|
|
|
|
test: /\.(sass|scss)$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
implementation: require('sass'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
include: path.resolve(__dirname, '../'),
|
|
|
|
},
|
2020-07-25 17:26:21 +08:00
|
|
|
{
|
|
|
|
test: /\.stories\.ts$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: require.resolve('./export-loader')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: require.resolve('ts-loader'),
|
|
|
|
options: {
|
|
|
|
transpileOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2020-07-24 19:20:37 +08:00
|
|
|
{
|
|
|
|
test: /\.(ts|tsx)$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: require.resolve('ts-loader'),
|
|
|
|
options: {
|
|
|
|
transpileOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
...config.resolve,
|
|
|
|
extensions: [...config.resolve.extensions, '.vue', '.ts'],
|
|
|
|
alias: {
|
|
|
|
...config.resolve.alias,
|
|
|
|
vue$: require.resolve('vue/dist/vue.esm-bundler.js'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.webpack = webpack;
|