-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
remix.config.js
55 lines (49 loc) · 1.78 KB
/
remix.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
const { withEsbuildOverride } = require('remix-esbuild-override');
const { environmentPlugin } = require('esbuild-plugin-environment');
const env = require('esbuild-plugin-env');
const fs = require('node:fs');
const copyFilesPlugin = require('esbuild-copy-static-files');
/**
* Define callbacks for the arguments of withEsbuildOverride.
* @param option - Default configuration values defined by the remix compiler
* @param isServer - True for server compilation, false for browser compilation
* @param isDev - True during development.
* @return {EsbuildOption} - You must return the updated option
*/
withEsbuildOverride((option /* { isServer, isDev } */) => {
const doNotBundleEnv = [
'APP_DOMAIN' // deny list for the environmentPlugin
]
const envFile = fs.readFileSync('./.env.example', 'utf-8');
const envFileLines = envFile.split('\n');
const envFileKeys = envFileLines.map(line => line.split('=')[0]);
const keysToBundle = envFileKeys.filter(key => !doNotBundleEnv.includes(key)).filter(key => key !== '');
option.plugins = [
copyFilesPlugin({
src: './public/locales',
dest: './public/build/locales',
errorOnExist: false
}),
copyFilesPlugin({
src: './public/favicon.ico',
dest: './public/build/favicon.ico',
errorOnExist: false
}),
env(),
environmentPlugin(keysToBundle),
...option.plugins
]
return option;
});
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
postcss: true,
server: './server.js',
serverMinify: true,
ignoredRouteFiles: ['**/__snapshots__/**', '**/.*', '**/*.test.tsx', '**/*.test.ts'],
appDirectory: 'src',
assetsBuildDirectory: "public/build",
serverBuildPath: "server/index.js",
publicPath: "/_static/build",
serverDependenciesToBundle: ['typescript-cookie']
};