-
Is it possible to include node-llama-cpp in one common js index.js file? I have try with rollup and webpack without success npx rollup -c rollup.config.js // my rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import shebang from 'rollup-plugin-preserve-shebang';
import ignore from 'rollup-plugin-ignore';
import json from '@rollup/plugin-json';
export default {
input: './src/index.ts', // Your entry file
output: {
dir: 'build', // Output bundled file
format: 'cjs', // cjs CommonJS for Node.js compatibility
sourcemap: true,
inlineDynamicImports: true, // optional: inline dynamic imports if needed
},
//external: ['node-llama-cpp'],
plugins: [
resolve({
preferBuiltins: true, // Prefer built-in Node.js modules
}),
commonjs(), // Convert CommonJS modules to ES6
typescript({ tsconfig: './tsconfig.json' }), // Use your tsconfig
json(), // Allows importing JSON files
ignore([
'fsevents' // add any other binary files you want to ignore
]),
shebang({
// Override the entry. By default, uses `input` from config:
//entry: path.resolve(process.cwd(), 'src/foo.js'),
// You can also set it manually if you want, which will always prepend it:
shebang: '#!/usr/bin/env node'
})
]
}; npx rollup -c rollup.config.js
|
Beta Was this translation helpful? Give feedback.
Answered by
sytolk
Oct 14, 2024
Replies: 1 comment
Answer selected by
giladgd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#151