forked from renlulu/poly-bridge-frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
91 lines (84 loc) · 2.84 KB
/
vue.config.js
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
87
88
89
90
91
const WebpackCdnPlugin = require('webpack-cdn-plugin');
const webpack = require('webpack');
const IN_PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = {
devServer: { https: false },
publicPath: process.env.VUE_APP_PUBLIC_PATH,
chainWebpack: (config) => {
config.devtool(!IN_PRODUCTION ? 'source-map' : false);
/* if (IN_PRODUCTION) {
config.plugin('cdn').use(WebpackCdnPlugin, [
{
modules: [
{ name: 'vue', var: 'Vue', path: 'dist/vue.runtime.min.js' },
{ name: 'vue-router', var: 'VueRouter', path: 'dist/vue-router.min.js' },
{ name: 'vuex', var: 'Vuex', path: 'dist/vuex.min.js' },
{ name: 'element-ui', var: 'ELEMENT', path: 'lib/index.js' },
],
prodUrl: '//cdn.jsdelivr.net/npm/:name@:version/:path',
publicPath: process.env.VUE_APP_PUBLIC_PATH,
},
]);
} */
},
configureWebpack: (config) => {
config.resolve.fallback = {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
os: require.resolve('os-browserify/browser'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
assert: require.resolve('assert'),
url: require.resolve('url'),
};
const bufferPlugin = new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] });
const processPlugin = new webpack.ProvidePlugin({ process: 'process/browser' });
const osPlugin = new webpack.ProvidePlugin({ os: 'os-browserify/browser' });
const streamPlugin = new webpack.ProvidePlugin({ stream: 'stream-browserify' });
const streamTransform = new webpack.ProvidePlugin({
_stream_transform: 'readable-stream/transform',
});
const streamDuplex = new webpack.ProvidePlugin({ _stream_duplex: 'readable-stream/duplex' });
const streamPassthrough = new webpack.ProvidePlugin({
_stream_passthrough: 'readable-stream/passthrough',
});
const streamReadable = new webpack.ProvidePlugin({
_stream_readable: 'readable-stream/readable',
});
const streamWritable = new webpack.ProvidePlugin({
_stream_writable: 'readable-stream/writable',
});
config.plugins.push(
...[
bufferPlugin,
processPlugin,
osPlugin,
streamPlugin,
streamTransform,
streamDuplex,
streamPassthrough,
streamReadable,
streamWritable,
],
);
},
pluginOptions: {
i18n: {
locale: 'zh-CN',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: false,
},
},
css: {
loaderOptions: {
sass: {
prependData: `
@import '@/styles/variables/index.scss';
@import '@/styles/mixins/index.scss';
`,
},
},
},
transpileDependencies: ['vue-echarts', 'resize-detector'],
};