0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/site/rollup.config.js
Luke Edwards 1d0da9d022 Use database for REPL, update URL structure (#2572)
* fix: move `shelljs` to dev-deps

* fix: move `codemirror` to “external” config only

* fix: move `yootils` to “external” config only

* chore: bump “sirv” dep

* chore: regenerate pkg-lock

* chore: add `.env.example` file

* chore: remove previous dependencies

* chore: add users migration

* feat: add `db` util w/ pool

* feat: handle GitHub OAuth directly, thru JWTs

* fix: hydrate `user` data & update keys

* fix: add timestamp columns to “users" table

* feat: save new gists to database

* feat: find & update gists

* fix: update client for new endpoints

* fix: always send { error } shape

* fix: rename “users.token” => "users.github_token”

* chore: include node-fetch as dev-dep

* fix: remove extra DATABASE_URL key

* fix: upload OAuth popup message

* chore: regenerate lock file

* add database entries for new gists, update REPL URLs

* implement saving and forking

* insert history entry when forking

* add logic for relaxed gists

* remove unnecessary on conflict clause
2019-05-05 00:33:30 -04:00

103 lines
2.2 KiB
JavaScript

import 'dotenv/config';
import resolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import commonjs from 'rollup-plugin-commonjs';
import svelte from 'rollup-plugin-svelte';
import babel from 'rollup-plugin-babel';
import json from 'rollup-plugin-json';
import { terser } from 'rollup-plugin-terser';
import config from 'sapper/config/rollup.js';
import pkg from './package.json';
const mode = process.env.NODE_ENV;
const dev = mode === 'development';
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
export default {
client: {
input: config.client.input(),
output: config.client.output(),
plugins: [
replace({
'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN)
}),
svelte({
dev,
hydratable: true,
emitCss: true
}),
resolve(),
commonjs(),
json(),
legacy && babel({
extensions: ['.js', '.mjs', '.html', '.svelte'],
runtimeHelpers: true,
exclude: ['node_modules/@babel/**'],
presets: [
['@babel/preset-env', {
targets: '> 0.25%, not dead'
}]
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-transform-runtime', {
useESModules: true
}]
]
}),
!dev && terser({
module: true
})
],
// temporary, pending Rollup 1.0
experimentalCodeSplitting: true
},
server: {
input: config.server.input(),
output: config.server.output(),
plugins: [
replace({
'process.browser': false,
'process.env.NODE_ENV': JSON.stringify(mode)
}),
svelte({
generate: 'ssr',
dev
}),
resolve(),
commonjs(),
json()
],
external: [
'yootils',
'codemirror',
...Object.keys(pkg.dependencies || {}).concat(
require('module').builtinModules || Object.keys(process.binding('natives'))
)
],
// temporary, pending Rollup 1.0
experimentalCodeSplitting: true
},
serviceworker: {
input: config.serviceworker.input(),
output: config.serviceworker.output(),
plugins: [
resolve(),
replace({
'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode)
}),
commonjs(),
!dev && terser()
]
}
};