|
1 |
| -const commonjs = require("@rollup/plugin-commonjs"); |
2 |
| -const typescript = require("@rollup/plugin-typescript"); |
3 |
| -const replace = require("rollup-plugin-replace"); |
| 1 | +import commonjs from "@rollup/plugin-commonjs"; |
| 2 | +import { nodeResolve } from "@rollup/plugin-node-resolve"; |
| 3 | +import replace from "@rollup/plugin-replace"; |
| 4 | +import terser from "@rollup/plugin-terser"; |
| 5 | +import typescript from "@rollup/plugin-typescript"; |
| 6 | +import { string } from "rollup-plugin-string"; |
4 | 7 |
|
5 |
| -const pkg = require("./package.json"); |
| 8 | +import pkg from "./package.json"; |
6 | 9 |
|
7 |
| -const configBase = { |
8 |
| - input: "src/index.ts", |
9 |
| - output: [ |
10 |
| - { |
11 |
| - file: pkg.main, |
12 |
| - exports: "named", |
13 |
| - format: "cjs", |
14 |
| - inlineDynamicImports: true, |
15 |
| - interop: "auto", |
16 |
| - }, |
17 |
| - { |
18 |
| - file: pkg.module, |
19 |
| - exports: "named", |
| 10 | +const configs = [ |
| 11 | + { |
| 12 | + input: "src/clients/node/inject-scripts/consoleHook.ts", |
| 13 | + output: { |
| 14 | + file: "src/clients/node/inject-scripts/dist/consoleHook.js", |
20 | 15 | format: "es",
|
21 |
| - inlineDynamicImports: true, |
22 | 16 | },
|
23 |
| - ], |
| 17 | + plugins: [ |
| 18 | + typescript({ |
| 19 | + tsconfig: "./tsconfig.json", |
| 20 | + compilerOptions: { declaration: false }, |
| 21 | + }), |
| 22 | + commonjs(), |
| 23 | + nodeResolve(), |
| 24 | + terser({ compress: { passes: 2 } }), |
| 25 | + ], |
| 26 | + external: [], |
| 27 | + }, |
| 28 | + |
| 29 | + { |
| 30 | + input: { |
| 31 | + index: "src/index.ts", |
| 32 | + "clients/node/index": "src/clients/node/index.ts", |
| 33 | + "clients/runtime/index": "src/clients/runtime/index.ts", |
| 34 | + }, |
| 35 | + output: [ |
| 36 | + { |
| 37 | + dir: "dist", |
| 38 | + format: "cjs", |
| 39 | + }, |
| 40 | + { |
| 41 | + dir: "dist", |
| 42 | + chunkFileNames: "[name]-[hash].mjs", |
| 43 | + entryFileNames: "[name].mjs", |
| 44 | + format: "es", |
| 45 | + }, |
| 46 | + ], |
24 | 47 |
|
25 |
| - plugins: [ |
26 |
| - typescript({ tsconfig: "./tsconfig.json" }), |
27 |
| - replace({ |
28 |
| - "process.env.CODESANDBOX_ENV": `"${process.env.CODESANDBOX_ENV}"`, |
29 |
| - "process.env.PACKAGE_VERSION": `"${pkg.version}"`, |
| 48 | + plugins: [ |
| 49 | + typescript({ tsconfig: "./tsconfig.json" }), |
| 50 | + string({ include: "**/dist/consoleHook.js" }), |
| 51 | + replace({ |
| 52 | + preventAssignment: true, |
| 53 | + values: { |
| 54 | + global: "globalThis", |
| 55 | + "process.env.CODESANDBOX_ENV": `"${process.env.CODESANDBOX_ENV}"`, |
| 56 | + "process.env.PACKAGE_VERSION": `"${pkg.version}"`, |
| 57 | + }, |
| 58 | + }), |
| 59 | + ], |
| 60 | + external: Object.keys({ |
| 61 | + ...(pkg.dependencies || {}), |
| 62 | + ...(pkg.devDependencies || {}), |
| 63 | + ...(pkg.peerDependencies || {}), |
30 | 64 | }),
|
31 |
| - commonjs({ requireReturnsDefault: "preferred" }), |
32 |
| - ], |
33 |
| - external: [ |
34 |
| - ...Object.keys(pkg.dependencies), |
35 |
| - ...Object.keys(pkg.devDependencies), |
36 |
| - ], |
37 |
| -}; |
| 65 | + }, |
| 66 | +]; |
38 | 67 |
|
39 |
| -module.exports = configBase; |
| 68 | +export default configs; |
1 commit comments
vercel[bot] commentedon Feb 28, 2023
Successfully deployed to the following URLs:
sandpack-docs – ./website/docs
sandpack-docs-codesandbox1.vercel.app
sandpack-docs-git-main-codesandbox1.vercel.app
sandpack.vercel.app