naive-ui/build/config.js

66 lines
1.7 KiB
JavaScript
Raw Normal View History

const path = require('path')
2020-03-20 22:52:54 +08:00
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
exports.alias = {
2020-03-04 19:25:46 +08:00
'naive-ui/lib/icons': path.resolve(__dirname, '../src/_icons'),
'src': path.resolve(__dirname, '../src')
2019-06-04 11:30:56 +08:00
}
2019-10-10 22:38:29 +08:00
2020-03-20 22:52:54 +08:00
exports.docLoaders = (env) => [
2019-10-10 22:38:29 +08:00
{
test: /index.entry$/,
loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDocEntryLoader.js')]
},
{
test: /index\.md$/,
loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDocLoader.js')]
},
{
test: /(README\.md$|\.vue\.md$)/,
loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIMdLoader.js')]
},
{
test: {
test: /\.md$/,
exclude: [/index\.md$/, /README\.md$/, /\.vue\.md$/]
},
loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDemoLoader.js')]
},
{
test: {
test: /\.vue$/
2019-10-10 22:38:29 +08:00
},
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
},
{
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-syntax-dynamic-import']
}
2019-10-10 22:38:29 +08:00
},
{
test: /\.(scss|css)$/,
2020-03-20 22:52:54 +08:00
use: [...(env === 'production' ? [MiniCssExtractPlugin.loader] : []), ...(env === 'production' ? [] : ['style-loader']), 'css-loader', 'postcss-loader', 'sass-loader']
2019-10-10 22:38:29 +08:00
},
{
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
}
},
{
resourceQuery: /blockType=i18n/,
type: 'javascript/auto',
loader: '@kazupon/vue-i18n-loader'
}
]