Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Oct 13, 2021
1 parent 1d854b7 commit a60f3a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/adapter-node/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default [
sourcemap: true
},
plugins: [nodeResolve(), commonjs(), json()],
external: ['../output/server/app.js', ...require('module').builtinModules]
external: ['@sveltejs/kit-app', ...require('module').builtinModules]
},
{
input: 'src/index.js',
Expand All @@ -21,7 +21,7 @@ export default [
sourcemap: true
},
plugins: [nodeResolve(), commonjs(), json()],
external: ['./middlewares.js', '../output/server/app.js', ...require('module').builtinModules]
external: ['./middlewares.js', '@sveltejs/kit-app', ...require('module').builtinModules]
},
{
input: 'src/shims.js',
Expand Down
14 changes: 5 additions & 9 deletions packages/kit/src/core/build/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fs from 'fs';
import { createRequire } from 'module';
import path from 'path';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import glob from 'tiny-glob/sync.js';
Expand Down Expand Up @@ -293,13 +292,6 @@ async function build_server(

find_deps(client_entry_file, entry_js, entry_css);

const adapter = config.kit.adapter;
// const require = createRequire(import.meta.url);
// const pkg_path = require.resolve(`${adapter}/package.json`);
// const pkg = JSON.parse(fs.readFileSync(pkg_path, 'utf8'));
// const main = path.resolve(pkg_path.substring(0, pkg_path.lastIndexOf('/')), pkg.main);
console.log(`adapter ${adapter}`);

fs.writeFileSync(
`${build_dir}/package.json`,
`{
Expand All @@ -311,10 +303,14 @@ console.log(`adapter ${adapter}`);
}`
);

// Write this in case in helps resolving node_modules to have the entry point
// inside the current project. Still doesn't seem to work
const adapter = config.kit.adapter;
const entry_point = `${output_dir}/index.js`;
fs.writeFileSync(
entry_point,
`import ${s(adapter)};`
`import ${s(adapter)};
`
);

const app_file = `${build_dir}/app.js`;
Expand Down

0 comments on commit a60f3a0

Please sign in to comment.