@fastly/compute-js-static-publish 2.0.0-alpha.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/build/build-static.js +2 -2
- package/package.json +1 -1
- package/src/build-static.ts +2 -2
package/README.md
CHANGED
|
@@ -85,12 +85,15 @@ These arguments are used to populate the `fastly.toml` and `package.json` files
|
|
|
85
85
|
| `cra-eject` | `./build` | `./build/static` | For apps written using Create React App, but which have since been ejected via `npm run eject`. Does not check for `react-scripts`. |
|
|
86
86
|
| `vite` | `./dist` | (None) | For apps written using [Vite](https://vitejs.dev). |
|
|
87
87
|
| `sveltekit` | `./dist` | (None) | For apps written using [SvelteKit](https://kit.svelte.dev). |
|
|
88
|
-
| `next` | `./out` | (None) | For apps written using [Next.js](https://nextjs.org), using `npm run export`.
|
|
88
|
+
| `next` | `./out` | (None) | For apps written using [Next.js](https://nextjs.org), using `npm run export`. *1 |
|
|
89
89
|
| `gatsby` | `./public` | (None) | For apps written using [Gatsby](https://www.gatsbyjs.com). |
|
|
90
90
|
| `docusaurus` | `./build` | (None) | For apps written using [Docusaurus](https://docusaurus.io) |
|
|
91
91
|
|
|
92
92
|
You may still override any of these options individually.
|
|
93
93
|
|
|
94
|
+
*1 - For Next.js, consider using `@fastly/next-compute-js`, a Node.js server implementation that allows you to run
|
|
95
|
+
your Next.js application on Compute@Edge.
|
|
96
|
+
|
|
94
97
|
## Issues
|
|
95
98
|
|
|
96
99
|
If you encounter any non-security-related bug or unexpected behavior, please [file an issue][bug].
|
package/build/build-static.js
CHANGED
|
@@ -104,7 +104,7 @@ export async function buildStaticLoader() {
|
|
|
104
104
|
});
|
|
105
105
|
const moduleTest = config.moduleTest;
|
|
106
106
|
const knownAssets = {};
|
|
107
|
-
let fileContents = '';
|
|
107
|
+
let fileContents = 'import { Buffer } from "buffer";\n';
|
|
108
108
|
for (const [index, file] of files.entries()) {
|
|
109
109
|
const relativeFilePath = path.relative('./src', file);
|
|
110
110
|
const contentDef = defaultContentTypes.testFileContentType(finalContentTypes, file);
|
|
@@ -122,7 +122,7 @@ export async function buildStaticLoader() {
|
|
|
122
122
|
let loadModule = false;
|
|
123
123
|
if (moduleTest != null && moduleTest(filePath)) {
|
|
124
124
|
loadModule = true;
|
|
125
|
-
fileContents += `import fileModule${index} from "${relativeFilePath}";\n`;
|
|
125
|
+
fileContents += `import * as fileModule${index} from "${relativeFilePath}";\n`;
|
|
126
126
|
}
|
|
127
127
|
knownAssets[filePath] = { contentType: type, isStatic, loadModule, };
|
|
128
128
|
}
|
package/package.json
CHANGED
package/src/build-static.ts
CHANGED
|
@@ -129,7 +129,7 @@ export async function buildStaticLoader() {
|
|
|
129
129
|
|
|
130
130
|
const knownAssets: Record<string, {contentType: string, isStatic: boolean, loadModule: boolean}> = {};
|
|
131
131
|
|
|
132
|
-
let fileContents = '';
|
|
132
|
+
let fileContents = 'import { Buffer } from "buffer";\n';
|
|
133
133
|
|
|
134
134
|
for (const [index, file] of files.entries()) {
|
|
135
135
|
const relativeFilePath = path.relative('./src', file);
|
|
@@ -148,7 +148,7 @@ export async function buildStaticLoader() {
|
|
|
148
148
|
let loadModule = false;
|
|
149
149
|
if (moduleTest != null && moduleTest(filePath)) {
|
|
150
150
|
loadModule = true;
|
|
151
|
-
fileContents += `import fileModule${index} from "${relativeFilePath}";\n`;
|
|
151
|
+
fileContents += `import * as fileModule${index} from "${relativeFilePath}";\n`;
|
|
152
152
|
}
|
|
153
153
|
knownAssets[filePath] = { contentType: type, isStatic, loadModule, };
|
|
154
154
|
}
|