Created
January 19, 2019 03:23
-
-
Save arxpoetica/b71700a4893a43e3eabf45810ce4dd6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './src/_server/build/config' | |
import resolve from 'rollup-plugin-node-resolve'; | |
import replace from 'rollup-plugin-replace'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
// import builtins from 'rollup-plugin-node-builtins' | |
// import globals from 'rollup-plugin-node-globals' | |
import svelte from 'rollup-plugin-svelte'; | |
import babel from 'rollup-plugin-babel'; | |
import { terser } from 'rollup-plugin-terser'; | |
import config from 'sapper/config/rollup.js'; | |
import pkg from './package.json'; | |
import preprocess from './src/_server/build/rollup.preprocess' | |
import sharedVars from './src/_server/build/rollup.vars' | |
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(Object.assign({ | |
'process.browser': true, | |
'process.server': false, | |
}, sharedVars)), | |
svelte({ | |
dev, | |
extensions: ['.html', '.svelte', '.svg'], | |
hydratable: true, | |
emitCss: true, | |
preprocess, | |
}), | |
// globals(), | |
// builtins(), | |
resolve({ browser: true }), | |
commonjs(), | |
legacy && babel({ | |
extensions: ['.js', '.html'], | |
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, | |
}), | |
], | |
// TODO: DELETE | |
experimentalCodeSplitting: true, | |
}, | |
server: { | |
input: config.server.input(), | |
output: config.server.output(), | |
plugins: [ | |
replace(Object.assign({ | |
'process.browser': false, | |
'process.server': true, | |
}, sharedVars)), | |
svelte({ | |
dev, | |
extensions: ['.html', '.svelte', '.svg'], | |
generate: 'ssr', | |
preprocess, | |
}), | |
resolve(), | |
commonjs(), | |
], | |
external: Object.keys(pkg.dependencies).concat( | |
require('module').builtinModules || Object.keys(process.binding('natives')) | |
), | |
// TODO: DELETE | |
experimentalCodeSplitting: true, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment