site: rollup resolve and onwarn improvements from sapper-template

pull/3934/head
Conduitry 5 years ago
parent 7e2e23e7ae
commit feafc34f8e

@ -13,6 +13,9 @@ const mode = process.env.NODE_ENV;
const dev = mode === 'development'; const dev = mode === 'development';
const legacy = !!process.env.SAPPER_LEGACY_BUILD; const legacy = !!process.env.SAPPER_LEGACY_BUILD;
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');
export default { export default {
client: { client: {
input: config.client.input(), input: config.client.input(),
@ -28,7 +31,10 @@ export default {
hydratable: true, hydratable: true,
emitCss: true emitCss: true
}), }),
resolve(), resolve({
browser: true,
dedupe
}),
commonjs(), commonjs(),
json(), json(),
@ -53,6 +59,7 @@ export default {
module: true module: true
}) })
], ],
onwarn
}, },
server: { server: {
@ -67,7 +74,9 @@ export default {
generate: 'ssr', generate: 'ssr',
dev dev
}), }),
resolve(), resolve({
dedupe
}),
commonjs(), commonjs(),
json() json()
], ],
@ -78,6 +87,7 @@ export default {
require('module').builtinModules || Object.keys(process.binding('natives')) require('module').builtinModules || Object.keys(process.binding('natives'))
) )
], ],
onwarn
}, },
serviceworker: { serviceworker: {

Loading…
Cancel
Save