mirror of https://github.com/nocodb/nocodb
278 lines
7.8 KiB
278 lines
7.8 KiB
2 years ago
|
import MonacoEditorWebpackPlugin from 'monaco-editor-webpack-plugin';
|
||
4 years ago
|
|
||
|
// import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||
2 years ago
|
const fs = require('fs');
|
||
|
const packageJson = JSON.parse(fs.readFileSync('../nc-lib-gui/package.json', 'utf8'));
|
||
4 years ago
|
export default {
|
||
|
/*
|
||
2 years ago
|
** Nuxt rendering mode
|
||
|
** See https://nuxtjs.org/api/configuration-mode
|
||
|
*/
|
||
4 years ago
|
mode: 'spa',
|
||
|
// ssr: false,
|
||
|
/*
|
||
2 years ago
|
** Nuxt target
|
||
|
** See https://nuxtjs.org/api/configuration-target
|
||
|
*/
|
||
3 years ago
|
target: 'server',
|
||
4 years ago
|
/*
|
||
2 years ago
|
** Headers of the page
|
||
|
** See https://nuxtjs.org/api/configuration-head
|
||
|
*/
|
||
4 years ago
|
head: {
|
||
|
titleTemplate: '',
|
||
|
title: 'NocoDB',
|
||
|
meta: [
|
||
3 years ago
|
{ charset: 'utf-8' },
|
||
3 years ago
|
{
|
||
|
name: 'viewport',
|
||
2 years ago
|
content: 'width=device-width, initial-scale=1',
|
||
3 years ago
|
},
|
||
|
{
|
||
|
hid: 'description',
|
||
|
name: 'description',
|
||
2 years ago
|
content: process.env.npm_package_description || '',
|
||
|
},
|
||
4 years ago
|
],
|
||
|
link: [
|
||
3 years ago
|
{
|
||
|
rel: 'icon',
|
||
|
type: 'image/x-icon',
|
||
2 years ago
|
href: './favicon.ico',
|
||
|
},
|
||
|
],
|
||
4 years ago
|
},
|
||
|
/*
|
||
2 years ago
|
** Global CSS
|
||
|
*/
|
||
4 years ago
|
/*
|
||
2 years ago
|
** Plugins to load before mounting the App
|
||
|
** https://nuxtjs.org/guide/plugins
|
||
|
*/
|
||
4 years ago
|
plugins: [
|
||
3 years ago
|
{ src: '~plugins/api.js' },
|
||
3 years ago
|
'~/plugins/xutils.js',
|
||
3 years ago
|
{
|
||
|
src: '~plugins/localStorage.js',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
|
{
|
||
|
src: '~plugins/confetti.js',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
3 years ago
|
{
|
||
|
src: '~plugins/domPurify.js',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
3 years ago
|
{
|
||
|
src: '~plugins/axiosInterceptor.js',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
3 years ago
|
'@/plugins/veeValidate',
|
||
|
'@/plugins/vueTour',
|
||
3 years ago
|
{
|
||
|
src: '@/plugins/vueShortkey',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
3 years ago
|
'@/plugins/vueClipboard',
|
||
|
'@/plugins/globalComponentLoader',
|
||
|
'@/plugins/globalMixin',
|
||
|
'@/plugins/globalEventBus',
|
||
3 years ago
|
'@/plugins/ncApis',
|
||
3 years ago
|
'~/plugins/i18n.js',
|
||
3 years ago
|
{
|
||
|
src: '~plugins/projectLoader.js',
|
||
2 years ago
|
ssr: false,
|
||
3 years ago
|
},
|
||
|
{
|
||
|
src: '~/plugins/tele.js',
|
||
2 years ago
|
ssr: false,
|
||
|
},
|
||
4 years ago
|
],
|
||
|
/*
|
||
2 years ago
|
** Auto import components
|
||
|
** See https://nuxtjs.org/api/configuration-components
|
||
|
*/
|
||
4 years ago
|
// components: true,
|
||
|
/*
|
||
2 years ago
|
** Nuxt.js dev-modules
|
||
|
*/
|
||
|
buildModules: ['@nuxtjs/vuetify'],
|
||
4 years ago
|
/*
|
||
2 years ago
|
** Nuxt.js modules
|
||
|
*/
|
||
4 years ago
|
modules: [
|
||
|
// Doc: https://axios.nuxtjs.org/usage
|
||
|
'@nuxtjs/axios',
|
||
|
'vue-github-buttons/nuxt',
|
||
2 years ago
|
'@nuxtjs/toast',
|
||
4 years ago
|
],
|
||
|
toast: {
|
||
2 years ago
|
position: 'top-center',
|
||
4 years ago
|
},
|
||
|
/*
|
||
2 years ago
|
** Axios module configuration
|
||
|
** See https://axios.nuxtjs.org/options
|
||
|
*/
|
||
4 years ago
|
axios: {
|
||
2 years ago
|
baseURL: process.env.NC_BACKEND_URL || (process.env.NODE_ENV === 'production' ? '..' : 'http://localhost:8080'),
|
||
4 years ago
|
},
|
||
|
/*
|
||
2 years ago
|
** vuetify module configuration
|
||
|
** https://github.com/nuxt-community/vuetify-module
|
||
|
*/
|
||
4 years ago
|
router: {
|
||
3 years ago
|
mode: 'hash',
|
||
4 years ago
|
// base: '/xc/',
|
||
2 years ago
|
middleware: ['auth'],
|
||
4 years ago
|
},
|
||
|
vuetify: {
|
||
4 years ago
|
defaultAssets: {
|
||
|
// font: false,
|
||
2 years ago
|
icons: false,
|
||
4 years ago
|
},
|
||
4 years ago
|
optionsPath: '@/config/vuetify.options.js',
|
||
|
treeShake: true,
|
||
2 years ago
|
customVariables: ['./config/variables.scss'],
|
||
4 years ago
|
},
|
||
|
/*
|
||
2 years ago
|
** Build configuration
|
||
|
** See https://nuxtjs.org/api/configuration-build/
|
||
|
*/
|
||
4 years ago
|
build: {
|
||
3 years ago
|
parallel: true,
|
||
4 years ago
|
plugins: [
|
||
|
new MonacoEditorWebpackPlugin({
|
||
|
// https://github.com/Microsoft/monaco-editor-webpack-plugin#options
|
||
|
// Include a subset of languages support
|
||
|
// Some language extensions like typescript are so huge that may impact build performance
|
||
|
// e.g. Build full languages support with webpack 4.0 takes over 80 seconds
|
||
|
// Languages are loaded on demand at runtime
|
||
3 years ago
|
languages: ['sql', 'json', 'javascript'],
|
||
2 years ago
|
features: ['!gotoSymbol'],
|
||
|
}),
|
||
4 years ago
|
],
|
||
|
// publicPath: process.env.NODE_ENV === 'production' ? `https://cdn.jsdelivr.net/npm/nc-lib-gui@${version}/lib/dist/` : undefined,
|
||
3 years ago
|
publicPath: process.env.NODE_ENV === 'production' ? './_nuxt/' : undefined,
|
||
2 years ago
|
extend(config, { isDev, isClient }) {
|
||
4 years ago
|
if (isDev) {
|
||
2 years ago
|
config.devtool = isClient ? 'source-map' : 'inline-source-map';
|
||
4 years ago
|
}
|
||
4 years ago
|
|
||
2 years ago
|
config.externals = config.externals || {};
|
||
|
config.externals['@microsoft/typescript-etw'] = 'FakeModule';
|
||
4 years ago
|
|
||
|
// config.plugins.push(new MonacoEditorWebpackPlugin({
|
||
|
// languages: ['javascript', 'typescript', 'json', 'mysql', 'sql', 'pgsql'],
|
||
|
// features: ['!gotoSymbol', '!goToCommands']
|
||
|
// }))
|
||
|
|
||
|
if (!isDev) {
|
||
|
// const WebpackObfuscator = require('webpack-obfuscator');
|
||
|
// config.plugins.push(new WebpackObfuscator({
|
||
|
// compact: true,
|
||
|
// controlFlowFlattening: false,
|
||
|
// deadCodeInjection: false,
|
||
|
// debugProtection: false,
|
||
|
// debugProtectionInterval: false,
|
||
|
// disableConsoleOutput: true,
|
||
|
// identifierNamesGenerator: 'hexadecimal',
|
||
|
// log: false,
|
||
|
// numbersToExpressions: false,
|
||
|
// renameGlobals: false,
|
||
|
// rotateStringArray: true,
|
||
|
// selfDefending: true,
|
||
|
// shuffleStringArray: true,
|
||
|
// simplify: true,
|
||
|
// splitStrings: false,
|
||
|
// stringArray: true,
|
||
|
// stringArrayEncoding: false,
|
||
|
// stringArrayThreshold: 0.75,
|
||
|
// unicodeEscapeSequence: false
|
||
|
// }))
|
||
|
|
||
|
// relative links, please.
|
||
|
// config.output.publicPath = "http://35.244.225.21/_nuxt/";
|
||
|
// config.output.publicPath = "./_nuxt/";
|
||
|
// NOTE: future release version of xc-lib-gui
|
||
|
|
||
3 years ago
|
if (process.env.targetEnv === 'DEV') {
|
||
|
// nightly build
|
||
|
// e.g. 0.84.2-20220220-1250
|
||
2 years ago
|
packageJson.version = `${packageJson.version}-${process.env.targetVersion}`;
|
||
|
packageJson.name += '-daily';
|
||
3 years ago
|
} else {
|
||
2 years ago
|
packageJson.version = process.env.targetVersion;
|
||
3 years ago
|
}
|
||
2 years ago
|
fs.writeFileSync('../nc-lib-gui/package.json', JSON.stringify(packageJson, 0, 2));
|
||
4 years ago
|
|
||
|
// config.output.publicPath = `https://cdn.jsdelivr.net/npm/nc-lib-gui@${version}/lib/dist/`;
|
||
|
// const htmlWebpack = config.plugins.find(w => w instanceof HtmlWebpackPlugin);
|
||
|
// htmlWebpack.options.publicPath = `https://cdn.jsdelivr.net/npm/xc-lib-gui@${version}/lib/dist/_nuxt/`;
|
||
|
// const templateParams = htmlWebpack.templateParameters
|
||
|
// htmlWebpack.templateParameters = (...args) =>{
|
||
|
// const res = templateParams(...args);
|
||
|
// return res;
|
||
|
// };
|
||
|
}
|
||
|
if (!isDev) {
|
||
2 years ago
|
config.output.publicPath = './_nuxt/';
|
||
4 years ago
|
}
|
||
|
|
||
2 years ago
|
return config;
|
||
|
},
|
||
4 years ago
|
},
|
||
4 years ago
|
loading: {
|
||
|
color: '#13f4ef',
|
||
|
height: '0px',
|
||
|
continuous: true,
|
||
2 years ago
|
duration: 3000,
|
||
4 years ago
|
},
|
||
4 years ago
|
css: [
|
||
3 years ago
|
'@/assets/style/fonts.css',
|
||
4 years ago
|
'@/assets/css/global.css',
|
||
|
// "~/assets/style/app.styl",
|
||
3 years ago
|
'@mdi/font/css/materialdesignicons.css',
|
||
|
'~/assets/style/style.css',
|
||
4 years ago
|
'~/assets/style.css',
|
||
2 years ago
|
'material-design-icons-iconfont/dist/material-design-icons.css',
|
||
4 years ago
|
],
|
||
|
env: {
|
||
3 years ago
|
EE: !!process.env.EE,
|
||
2 years ago
|
NC_API_URL: 'https://nocodb.com',
|
||
3 years ago
|
},
|
||
|
pwa: {
|
||
|
workbox: {
|
||
|
/* workbox options */
|
||
|
assetsURLPattern: './_nuxt/',
|
||
2 years ago
|
pagesURLPattern: './',
|
||
3 years ago
|
},
|
||
|
manifest: {
|
||
2 years ago
|
publicPath: './',
|
||
|
},
|
||
|
},
|
||
|
};
|
||
4 years ago
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
4 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
4 years ago
|
*/
|