-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.js
91 lines (85 loc) · 3.61 KB
/
vite.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
import ViteRestart from 'vite-plugin-restart';
import * as path from 'path';
// https://vitejs.dev/config/
export default ({command}) => ({
base: command === 'serve' ? '' : '/dist/',
// Path starts from the project path, in our case 'assets' where package.json is
root: 'assets/src',
// Relative to "root" setting folder
publicDir: '../public',
// https://github.com/vitejs/vite/discussions/7920
esbuild: {
drop: ['console', 'debugger'],
},
build: {
emptyOutDir: true,
manifest: true,
// outDir is relative to 'root' as defined above
outDir: '../dist',
// rollupOptions is relative to 'root' as defined above
rollupOptions: {
input: {
cp: '/core/SproutCp.js',
alpine: '/core/SproutAlpine.js',
adminTable: '/core/SproutAdminTable.js',
emailTypes: '/mailer/EmailTypesSettings.js',
sendEmailModal: '/mailer/SendEmailModal.js',
sentEmailDetailsModal: '/sent-email/SentEmailDetailsModal.js',
transactionalEmail: '/transactional/NotificationEvents.js',
// copyPaste: '/campaigns/CopyPaste.js',
// notifications: '/notifications/Notifications.js',
redirects: '/redirects/Redirects.js',
dataStudio: '/data-studio/DataStudio.js',
dataSetIndex: '/data-studio/DataSetIndex.js',
sitemapMetadata: '/sitemaps/SitemapMetadata.js',
meta: '/meta/Meta.js',
addressField: '/fields/AddressField.js',
emailField: '/fields/EmailField.js',
phoneField: '/fields/PhoneField.js',
regularExpressionField: '/fields/RegularExpressionField.js',
urlField: '/fields/UrlField.js',
forms: '/forms/Forms.js',
formTypes: '/forms/FormTypesSettings.js',
integrationTypes: '/forms/IntegrationTypesSettings.js',
submissionStatusSettings: '/forms/SubmissionStatusSettings.js',
// Front End
DynamicCsrfInput: '/core/DynamicCsrfInput.js',
accessibility: '/forms-frontend/Accessibility.js',
addressFieldFrontEnd: '/forms-frontend/AddressField.js',
disableSubmitButton: '/forms-frontend/DisableSubmitButton.js',
rules: '/forms-frontend/Rules.js',
submitHandler: '/forms-frontend/SubmitHandler.js',
reCaptchaCheckbox: '/forms-frontend/recaptcha_v2_checkbox.js',
reCaptchaInvisible: '/forms-frontend/recaptcha_v2_invisible.js',
},
output: {
sourcemap: true,
},
},
},
plugins: [
ViteRestart({
reload: [
'../../src/**/templates/**/*',
],
}),
],
resolve: {
alias: [
{find: '@', replacement: path.resolve(__dirname, './assets/public')},
],
preserveSymlinks: true,
},
server: {
host: '0.0.0.0',
/* .com/core/fonts/... in production, dev... */
origin: 'https://demo.projectmothership.com.ddev.site:3002', // https://nystudio107.com/blog/using-vite-js-next-generation-frontend-tooling-with-craft-cms#vite-processed-assets
port: 39999, // DDEV Internal Port
strictPort: true,
hmr: {
// To run vite in DDEV we need to recognize the port mapping
// https://vitejs.dev/config/server-options.html#server-hmr
clientPort: 3002, // DDEV External Port (HTTPS)
},
},
});