You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with `v4.0.0` of this tool, webpack is no longer required and is disabled by default for new applications. This can simplify development and result in shorter build times.
41
-
42
-
You may still wish to use webpack if you need some of the features it provides, e.g., the ability to use loaders, asset modules, module replacement, dynamic imports, etc.
43
-
44
-
To migrate away from using webpack, make the following changes in your `./compute-js` directory:
45
-
46
-
* First, check your `webpack.config.js` file to make sure you aren't actually depending on any custom webpack features. When you're ready, continue to the next step.
47
-
* Delete `webpack.config.js`.
48
-
* Modify `static-publish.rc.js`:
49
-
* Change the line `module.exports = {` to `const config = {`
50
-
* At the end of the file, add `export default config;`
51
-
* In your `package.json` file:
52
-
* At the top level, add a `"type"` key if one doesn't already exist, with the value `"module"`.
53
-
* Under `devDependencies`, remove the `webpack` and `webpack-cli` entries.
54
-
* Under `scripts`, modify the `prebuild` script by removing the `&& webpack` at the end
55
-
of it.
56
-
* Under `scripts`, modify the `build` script by replacing the parameter `./bin/index.js`
57
-
with `./src/index.js`.
58
-
* In the end, the two scripts should look like this (along with any other scripts you may have):
* A new key, `server`, was added to group configurations that pertain to Publisher Server.
201
-
202
-
To migrate this file, you'll need to make the following changes:
203
-
204
-
*`publicDir` - rename this to `rootDir`. All files under this root directory will be included by default in the publishing,
205
-
except for those that are excluded using some of the following features.
206
-
*`excludeDirs`, `includeDirs`, `excludeTest`, `moduleTest` - In v3, these were used in combination to determine whether
207
-
each file would be included in the publishing, and whether files would be included as modules. The interaction between
208
-
these four tests was not clearly defined, often having one option exclude files, only to have other options add them
209
-
back. In addition, in v3 it was not possible to have a module asset that was not also already a content asset.
210
-
In v4, these are more clearly defined. These four options should be rewritten in terms of
211
-
`excludeDirs`, `excludeDotFiles`, `includeWellKnown`, `contentAssetInclusionTest`, and `moduleAssetInclusionTest`.
212
-
*`staticDirs` - in v4, this was renamed to `staticItems` and moved under the new `server` key.
213
-
*`spa` - in v4, this was renamed to `spaFile` and moved under the new `server` key.
214
-
*`notFoundPage` - in v4, this was renamed to `notFoundPageFile` and moved under the new `server` key.
215
-
*`autoExt` - in v4, this was moved under the new `server` key.
216
-
*`autoIndex` - in v4, this was moved under the new `server` key.
217
-
*`contentTypes` - This is unchanged.
218
-
219
-
See [static-publish.rc.js config file](./README.md#static-publish-rc) for a detailed explanation of each of these new values.
220
-
221
-
*`.gitignore`
222
-
223
-
Depending on the version of `compute-js-static-publisher` used to scaffold your application, your `.gitignore` file
224
-
may have been generated with different entries. Add any of the following entries that may be missing from your
225
-
`.gitignore` file:
226
-
227
-
```gitignore
228
-
/src/statics.js
229
-
/src/statics.d.ts
230
-
/src/statics-metadata.js
231
-
/src/statics-metadata.d.ts
232
-
/src/static-content
233
-
```
234
-
235
-
* Build scripts
236
-
* Various versions of `@fastly/compute-js-static-publish` have specified different build scripts. We recommend the following setup, regardless of the version of `@fastly/compute-js-static-publish` or Fastly CLI.
237
-
238
-
* The build script listed in `fastly.toml` of your `compute-js` directory should look like this:
239
-
```toml
240
-
[scripts]
241
-
build = "npm run build"
242
-
```
243
-
244
-
* If you're using webpack, then the `scripts` section of `package.json` of your `compute-js` directory should contain
245
-
the following items (along with any other scripts):
0 commit comments