Skip to content

Switching fails due to unknown schema entry in webpack.config.js #214

Open
@miketheman

Description

@miketheman

In #178 a new webpack configuration chunkFormat: "module" was added, and released in version 1.2.2.
This configuration flag does not exist in webpack 4, and was added in webpack 5.

jsbunlding-rails switching guide claims to support webpack 4 in its first line, but this new config option breaks the experience immediately with the auto-generated file, with this output:

webpack --config webpack.config.js

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.output has an unknown property 'chunkFormat'. These properties are valid:
    object { auxiliaryComment?, chunkCallbackName?, chunkFilename?, chunkLoadTimeout?, crossOriginLoading?, devtoolFallbackModuleFilenameTemplate?, devtoolLineToLine?, devtoolModuleFilenameTemplate?, devtoolNamespace?, filename?, futureEmitAssets?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunction?, jsonpScriptType?, library?, libraryExport?, libraryTarget?, path?, pathinfo?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine?, webassemblyModuleFilename? }
    -> Options affecting the output of the compilation. output options tell webpack how to write the compiled files to disk.

Commenting out the new config allows the build to complete:

diff --git a/webpack.config.js b/webpack.config.js
index 557a746..555104c 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -10,7 +10,7 @@ module.exports = {
   output: {
     filename: "[name].js",
     sourceMapFilename: "[file].map",
-    chunkFormat: "module",
+    // chunkFormat: "module",
     path: path.resolve(__dirname, "app/assets/builds"),
   },
   plugins: [

I looked for any mention of this in any issues/guides, didn't find any, so put this here to help any future migrators ease the transition between versions.

I could have tried to use jsbundling-rails 1.2.1 or earlier, but didn't try that, since I wanted to use the latest released version. I don't know if this will have further implications to my migration, but wanted to surface this while it was fresh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions