Blame view

components/vue-baidu-map/build/webpack.docs.config.js 2.04 KB
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  const path = require('path')
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin')
  const webpack = require('webpack')
  
  module.exports = {
    entry: {
      main: 'docs/main.js',
      libs: [
        'vue',
        'vue-router',
        'prismjs',
        'vue-material'
      ],
      resource: [
        'prismjs/themes/prism-tomorrow.css',
        'docs/fonts/iconfont.css'
      ],
      vendor: [
        'docs/components/App.vue',
        'docs/components/CateView.vue',
        'docs/components/DocPreview.vue',
        'docs/components/Navigator.vue',
        'docs/components/RootFrame.vue'
      ]
    },
    output: {
      path: path.resolve(__dirname, '../dist'),
      filename: '[name].[hash:8].bundle.js',
      chunkFilename: '[name].[chunkhash:8].js'
    },
    module: {
      rules: [
        {
          test: /\.vue$/,
          use: ['vue-loader', 'eslint-loader'],
          exclude: [/_cache/]
        },
        {
          test: /\.js$/,
          use: ['babel-loader', 'eslint-loader'],
          exclude: [/node_modules/, /md/]
        },
        {
          test: /\.md$/,
          use: ['vue-markdown-loader'],
          exclude: [/node_modules/]
        },
        {
          test: /\.css$/,
          use: ['style-loader', 'css-loader']
        },
        {
          test: /\.styl$/,
          use: ['style-loader', 'css-loader', 'stylus-loader']
        },
        {
          test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
          use: ['url-loader']
        },
        {
          test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
          use: ['url-loader']
        }
      ]
    },
    resolve: {
      alias: {
        docs: path.resolve(__dirname, '../docs')
      }
    },
    plugins: [
      new webpack.HashedModuleIdsPlugin(),
      new HtmlWebpackPlugin({
        template: path.resolve(__dirname, '../docs/template/index.html'),
        chunks: ['libs', 'vendor', 'resource', 'main']
      }),
      new webpack.optimize.CommonsChunkPlugin({
        names: ['vendor', 'libs', 'resource', 'manifest'],
        minChunks: Infinity
      }),
      new InlineManifestWebpackPlugin({
        name: 'webpackManifest'
      })
    ]
  }