12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- var path = require('path')
- var utils = require('./utils')
- var config = require('../config')
- var vueLoaderConfig = require('./vue-loader.conf')
- const webpack = require('webpack')
- const manifest = require('../vendor-manifest.json')
- function resolve(dir) {
- return path.join(__dirname, '..', dir)
- }
- module.exports = {
- entry: {
- // app: './src/main.js',
- app: ['babel-polyfill', './src/main.js']
- },
- output: {
- path:process.env.NODE_ENV === 'production'? config.build.assetsRoot:config.test.assetsRoot,
- filename: '[name].js',
- publicPath: process.env.NODE_ENV === 'production'
- ? config.build.assetsPublicPath
- :process.env.NODE_ENV === 'test'
- ?config.test.assetsPublicPath
- :config.dev.assetsPublicPath
- },
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- '@': resolve('src'),
- 'scss_vars': '@/styles/vars.scss',
- 'index_scss': '@/styles/index.scss',
- 'api': '@/api',
- 'utils': '@/utils',
- 'components': '@/components',
- 'common': '@/common'
- }
- },
- externals:{
- "vue":"Vue",
- "echarts": 'echarts'
- },
- plugins: [
- new webpack.DllReferencePlugin({
- manifest
- })
- ],
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: vueLoaderConfig
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: [
- resolve('src'),
- resolve('static'),
- resolve('/node_modules/element-ui'),
- ]
- },
- {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }
- ]
- }
- }
|