"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var webpack_1 = __importDefault(require("webpack"));
var webpackbar_1 = __importDefault(require("webpackbar"));
var vue_loader_1 = require("vue-loader");
var dic_1 = require("../util/dic");
var util_1 = require("../util");
var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
var nutui_config = require(dic_1.ROOT_PACKAGE_PATH('package.json'));
var nutui_cli_config = require(dic_1.ROOT_CLI_PATH('package.json'));
exports.baseConfig = {
    stats: 'errors-only',
    output: {
        publicPath: './' //相对路径
    },
    resolve: {
        extensions: ['.js', '.vue', '.json'],
        alias: {
            vue$: 'vue/dist/vue.esm.js',
            '@': dic_1.ROOT_PACKAGE_PATH('src')
        },
        symlinks: false
    },
    module: {
        rules: [
            util_1.isTest()
                ? {}
                : {
                    test: /\.(sa|sc|c)ss$/,
                    use: [
                        util_1.isDev() ? 'style-loader' : {
                            loader: mini_css_extract_plugin_1.default.loader,
                            options: {
                                publicPath: '../',
                            },
                        },
                        'css-loader',
                        'postcss-loader',
                        {
                            loader: 'sass-loader',
                            options: {
                                prependData: "@import \"@/styles/index.scss\"; "
                            }
                        }
                    ]
                },
            {
                test: /\.vue$/,
                use: [
                    'cache-loader',
                    {
                        loader: 'vue-loader',
                        options: {
                            loaders: {
                                sass: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
                            }
                        }
                    }
                ]
            },
            {
                test: /\.js$/,
                include: [dic_1.ROOT_PACKAGE_PATH('src'), dic_1.ROOT_CLI_PATH('site')],
                use: ['cache-loader', 'babel-loader']
            },
            {
                test: /\.(png|jpe?g|gif|webp)$/,
                loader: 'url-loader',
                include: [dic_1.ROOT_PACKAGE_PATH('src/assets/img'), dic_1.ROOT_CLI_PATH('site')],
                options: {
                    limit: 3000,
                    name: 'img/[name].[ext]',
                    esModule: false // 否则加载时为 [object]
                }
            },
            {
                test: /\.svg$/,
                loader: 'raw-loader',
                include: [dic_1.ROOT_PACKAGE_PATH('src/assets/svg')],
                options: {
                    esModule: false // 否则加载时为 [object]
                }
            }
        ]
    },
    plugins: [
        new webpack_1.default.BannerPlugin({
            banner: nutui_config.name + " v" + nutui_config.version + " - [filebase], [hash], " + new Date() + "\n(c) 2017-2020 JDC\nReleased under the MIT License."
        }),
        new vue_loader_1.VueLoaderPlugin(),
        new webpackbar_1.default({
            name: "NutUI CLI v" + nutui_cli_config.version,
            color: '#5396ff'
        })
    ]
};
//# sourceMappingURL=base.config.js.map