forked from skeditor/skeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
75 lines (71 loc) · 2.24 KB
/
nuxt.config.ts
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
import path from 'path';
import { defineNuxtConfig } from 'nuxt3';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
require('dotenv').config();
export default defineNuxtConfig({
ssr: false,
target: 'static',
modern: true,
vite: false,
env: {
PUBLIC_PATH: process.env.NODE_ENV === 'development' ? '/' : process.env['PUBLIC_PATH'],
},
buildModules: [
'@nuxtjs/eslint-module',
{
handler: function () {
this.nuxt.hook('webpack:config', (configs) => {
configs.forEach((config) => {
(config.resolve || (config.resolve = {})).fallback = {
path: false,
fs: false,
};
const svgCompDir = path.join(__dirname, 'assets/svg-comp');
config.module?.rules?.forEach((rule) => {
if (typeof rule === 'object' && rule.test instanceof RegExp)
if (rule.test.test('.svg')) {
rule.exclude = [svgCompDir];
}
});
config.module?.rules?.push({
test: /\.svg$/,
include: [svgCompDir],
use: [
'vue-loader',
path.resolve('./scripts/svg-comp-loader.js'),
'svg-sprite-loader',
{
loader: 'svgo-loader',
options: {
plugins: [
{
name: 'convertColors',
params: { currentColor: true },
},
],
},
},
],
});
});
});
},
},
],
css: ['~/assets/global.css', 'vue3-perfect-scrollbar/dist/vue3-perfect-scrollbar.css'],
plugins: ['~/plugins/config.client.ts'],
build: {
publicPath: process.env.NODE_ENV === 'development' ? undefined : process.env['PUBLIC_PATH'] + '_nuxt/',
plugins: [new ForkTsCheckerWebpackPlugin()],
// extend(config) {
// console.log('>>>> got config');
// process.exit();
// const node = config.node || (config.node = {});
// node.fs = 'empty';
// config.module.rules.push({
// test: /.wasm/i,
// type: 'javascript/auto',
// });
// },
},
});