File size: 984 Bytes
61d39e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import path from 'node:path';
import webpack from 'webpack';

// '__dirname' isn't defined by default in ES modules.
// We didn't really want to migrate this file to ESM because
// it's config for tooling that only runs in node, but alas
// if package.json says "type": "module" then we have to use
// ESM syntax everywhere unless we rename this to a .cjs file
// and add an extra flag everywhere we use webpack.
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default {
    entry: './src/index.js',
    output: {
        filename: 'puter.js',
        path: path.resolve(__dirname, 'dist'),
    },
    plugins: [
        new webpack.DefinePlugin({
            'globalThis.PUTER_ORIGIN_ENV': JSON.stringify(process.env.PUTER_ORIGIN || 'https://puter.com'),
            'globalThis.PUTER_API_ORIGIN_ENV': JSON.stringify(process.env.PUTER_API_ORIGIN || 'https://api.puter.com'),
        }),
    ],
};