-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rollup build example #985
Comments
Browser basis: import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import ignore from 'rollup-plugin-ignore'
import terser from '@rollup/plugin-terser'
import packageJson from '../package.json' assert { type: 'json' }
import json from '@rollup/plugin-json'
import path from 'path'
import OMT from "@surma/rollup-plugin-off-main-thread"
const omtCustom = OMT()
omtCustom.resolveImportMeta = () => {
return 'import.meta.url'
}
const bundleName = path.basename(packageJson.name)
export default {
input: './src/index.ts',
output: [
{
dir: `./dist`,
format: 'es',
sourcemap: true,
// plugins: [terser(),],
},
],
onwarn: function onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') return;
if (warning.message.includes('Very few browsers support ES modules in Workers.')) return;
console.log('onwarn', warning)
warn(warning);
},
plugins: [
ignore(['crypto']),
nodeResolve({
preferBuiltins: false,
browser: true,
}),
commonjs({
transformMixedEsModules: true
}),
nodePolyfills(),
typescript(),
json(),
omtCustom,
]
} Node basis: import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import terser from '@rollup/plugin-terser'
import packageJson from '../package.json' assert { type: 'json' }
import path from 'path'
const bundleName = path.basename(packageJson.name)
export default {
input: './src/index-node.ts',
output: [
{
dir: './dist',
format: 'es',
sourcemap: true,
// plugins: [terser(),],
},
],
onwarn: function onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') return;
warn(warning);
},
plugins: [
commonjs({
transformMixedEsModules: true
}),
nodeResolve({
preferBuiltins: true,
browser: false,
}),
typescript(),
json(),
],
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: