Skip to content

Commit

Permalink
change rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
aarron-lee committed Sep 19, 2024
1 parent 39c53e9 commit 185af3b
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,43 @@ import { nodeResolve } from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import typescript from "@rollup/plugin-typescript";
import importAssets from "rollup-plugin-import-assets";
import externalGlobals from 'rollup-plugin-external-globals';

import manifest from './plugin.json' with { type: 'json' };

export default deckyPlugin({
// add extra rollup options here
input: './src/index.tsx',
plugins: [
commonjs(),
nodeResolve({
browser: true,
browser: true
}),
externalGlobals({
react: 'SP_REACT',
'react-dom': 'SP_REACTDOM',
'@decky/ui': 'DFL',
'@decky/manifest': JSON.stringify(manifest)
}),
nodeResolve(),
typescript(),
json(),
replace({
preventAssignment: false,
"process.env.NODE_ENV": JSON.stringify("production"),
'process.env.NODE_ENV': JSON.stringify('production'),
}),
importAssets({
publicPath: `http://127.0.0.1:1337/plugins/${manifest.name}/`,
}),
publicPath: `http://127.0.0.1:1337/plugins/${manifest.name}/`
})
],
context: 'window',
external: ['react', 'react-dom', '@decky/ui'],
output: {
dir: "dist",
format: "esm",
dir: 'dist',
format: 'esm',
sourcemap: true,
// **Don't** change this.
sourcemapPathTransform: (relativeSourcePath) =>
relativeSourcePath.replace(
/^\.\.\//,
`decky://decky/plugin/${encodeURIComponent(manifest.name)}/`
),
exports: "default",
sourcemapPathTransform: (relativeSourcePath) => relativeSourcePath.replace(/^\.\.\//, `decky://decky/plugin/${encodeURIComponent(manifest.name)}/`),
exports: 'default'
},
});

0 comments on commit 185af3b

Please sign in to comment.