export targets to individual dir

This commit is contained in:
Pooya Parsa 2020-11-02 14:40:56 +01:00
parent b03eef0ceb
commit 9959411f60

View File

@ -43,7 +43,7 @@ export const getRollupConfig = (config) => {
const options: RollupConfig = { const options: RollupConfig = {
input: config.entry, input: config.entry,
output: { output: {
file: path.resolve(config.buildDir, 'dist/server', `index.${config.target}.js`), file: path.resolve(config.buildDir, `dist/${config.target}`, 'index.js'),
format: 'cjs', format: 'cjs',
intro: '', intro: '',
outro: '', outro: '',
@ -65,7 +65,7 @@ export const getRollupConfig = (config) => {
options.output.intro += 'const requireDynamic = require;' options.output.intro += 'const requireDynamic = require;'
options.plugins.push(replace({ options.plugins.push(replace({
values: { values: {
'require("./" +': 'requireDynamic("./" +' 'require("./" +': 'requireDynamic("../server/" +'
}, },
delimiters: ['', ''] delimiters: ['', '']
})) }))