1 | var path = require('path')
|
2 | var fs = require('fs')
|
3 | var utils = require('../libs/utils')
|
4 | var config = require('../config')
|
5 | var vueLoaderConfig = require('./vue-loader.conf')
|
6 |
|
7 | function resolve(dir) {
|
8 | return path.join(config.paths.src, dir)
|
9 | }
|
10 |
|
11 | module.exports = {
|
12 | target: require('mpvue-webpack-target'),
|
13 | output: {
|
14 | path: config.paths['wx-dist'],
|
15 | filename: '[name].js',
|
16 | publicPath: '/'
|
17 | },
|
18 | resolve: {
|
19 | extensions: ['.js', '.vue', '.json', ".ts", ".tsx"],
|
20 | alias: {
|
21 | 'vuex': 'vuex/dist/vuex.js',
|
22 | 'vue': 'mpvue',
|
23 |
|
24 | '@': resolve('./')
|
25 | },
|
26 | symlinks: false
|
27 | },
|
28 | module: {
|
29 | rules: [{
|
30 | test: /\.(tsx|ts)(\?.*)?$/,
|
31 | loader: "ts-loader"
|
32 | }, {
|
33 | test: /\.vue$/,
|
34 | loader: 'mpvue-loader',
|
35 | options: vueLoaderConfig
|
36 | }, {
|
37 | test: /\.js$/,
|
38 | include: [resolve('wx')],
|
39 | use: [
|
40 | 'babel-loader', {
|
41 | loader: 'mpvue-loader',
|
42 | options: {
|
43 | checkMPEntry: true
|
44 | }
|
45 | },
|
46 | ]
|
47 | }, {
|
48 | test: /\.mustache$/,
|
49 | loader: 'mustache-loader'
|
50 | }, {
|
51 | test: /\.ejs$/,
|
52 | loader: 'marauder-ejs-loader'
|
53 | }, {
|
54 | test: /\.art$/,
|
55 | loader: 'art-template-loader'
|
56 | }, {
|
57 | test: /\.(bmp|png|jpe?g|gif|svg)(\?.*)?$/,
|
58 | loader: 'url-loader',
|
59 | options: {
|
60 | limit: 10000,
|
61 | name: utils.assetsPath('img/[name].[hash:8].[ext]')
|
62 | }
|
63 | }, {
|
64 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
65 | loader: 'url-loader',
|
66 | options: {
|
67 | limit: 10000,
|
68 | name: utils.assetsPath('media/[name]].[ext]')
|
69 | }
|
70 | }, {
|
71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
72 | loader: 'file-loader',
|
73 | options: {
|
74 | limit: 10000,
|
75 | name: utils.assetsPath('fonts/[name].[ext]')
|
76 | }
|
77 | }]
|
78 | },
|
79 |
|
80 |
|
81 | node: {
|
82 |
|
83 |
|
84 | setImmediate: false,
|
85 | dgram: 'empty',
|
86 | fs: 'empty',
|
87 | net: 'empty',
|
88 | tls: 'empty',
|
89 | child_process: 'empty'
|
90 | }
|
91 | }
|