-
Notifications
You must be signed in to change notification settings - Fork 4
/
vue.config.js
64 lines (56 loc) · 1.91 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
const { defineConfig } = require("@vue/cli-service");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = defineConfig({
publicPath: "./",
chainWebpack: config => {
// These are some necessary steps changing the default webpack config of the Vue CLI
// that need to be changed in order for Typescript based components to generate their
// declaration (.d.ts) files.
//
// Discussed here https://github.com/vuejs/vue-cli/issues/1081
if (process.env.NODE_ENV === 'production') {
config.module.rule("ts").uses.delete("cache-loader");
config.module
.rule('ts')
.use('ts-loader')
.loader('ts-loader')
.tap(opts => {
opts.transpileOnly = false;
opts.happyPackMode = false;
return opts;
});
}
// Keep the very big WWT engine external
config.externals({
'@wwtelescope/engine': {
'amd': '@wwtelescope/engine', // typeof define === 'function' && define.amd
'commonjs2': '@wwtelescope/engine', // typeof exports === 'object' && typeof module === 'object'
'commonjs': '@wwtelescope/engine', // typeof exports === 'object'
'root': 'wwtlib' // none of the above: browser mode using global variables
},
pinia: 'pinia',
});
},
// TODO: For some reason we're having trouble loading chunks
// so until that's resolved, prevent JS chunking for this package
configureWebpack: {
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src/assets', to: 'assets' }
]
})
],
devtool: "inline-source-map"
},
// Also needed for the TypeScript declaration stuff (see link above)
parallel: false,
// Keep any CSS inside JS for transparent loading as a library.
css: {
extract: false
}
});