meteor v1.8 Release Notes

Release Date: 2018-10-08 // over 5 years ago
  • 💥 Breaking changes

    N/A

    Migration Steps

    • ⚡️ Update the @babel/runtime npm package to version 7.0.0 or later:
      meteor npm install @babel/runtime@latest
    

    🔄 Changes

    • 🚀 Although Node 8.12.0 has been released, Meteor 1.8 still uses Node 8.11.4, due to concerns about excessive garbage collection and CPU usage in production. To enable Galaxy customers to use Node 8.12.0, we are planning a quick follow-up Meteor 1.8.1 release, which can be obtained by running the command

      meteor update --release 1.8.1-beta.n
      

      where -beta.n is the latest beta release according to the releases page (currently -beta.6). Issue #10216 PR #10248

    • 💻 Meteor 1.7 introduced a new client bundle called web.browser.legacy in addition to the web.browser (modern) and web.cordova bundles. Naturally, this extra bundle increased client (re)build times. Since developers spend most of their time testing the modern bundle in development, and the legacy bundle mostly provides a safe fallback in production, Meteor 1.8 cleverly postpones building the legacy bundle until just after the development server restarts, so that development can continue as soon as the modern bundle has finished building. Since the legacy build happens during a time when the build process would otherwise be completely idle, the impact of the legacy build on server performance is minimal. Nevertheless, the legacy bundle still gets rebuilt regularly, so any legacy build errors will be surfaced in a timely fashion, and legacy clients can test the new legacy bundle by waiting a bit longer than modern clients. Applications using the autoupdate or hot-code-push packages will reload modern and legacy clients independently, once each new bundle becomes available. Issue #9948 PR #10055

    • 🔌 Compiler plugins that call inputFile.addJavaScript or inputFile.addStylesheet may now delay expensive compilation work by passing partial options ({ path, hash }) as the first argument, followed by a callback function as the second argument, which will be called by the build system once it knows the module will actually be included in the bundle. For example, here's the old implementation of BabelCompiler#processFilesForTarget:

      processFilesForTarget(inputFiles) {
      inputFiles.forEach(inputFile => {
        var toBeAdded = this.processOneFileForTarget(inputFile);
        if (toBeAdded) {
          inputFile.addJavaScript(toBeAdded);
        }
      });
      }
      

      and here's the new version:

      processFilesForTarget(inputFiles) {
      inputFiles.forEach(inputFile => {
        if (inputFile.supportsLazyCompilation) {
          inputFile.addJavaScript({
            path: inputFile.getPathInPackage(),
            hash: inputFile.getSourceHash(),
          }, function () {
            return this.processOneFileForTarget(inputFile);
          });
        } else {
          var toBeAdded = this.processOneFileForTarget(inputFile);
          if (toBeAdded) {
            inputFile.addJavaScript(toBeAdded);
          }
        }
      });
      }
      

      If you are an author of a compiler plugin, we strongly recommend using this new API, since unnecessary compilation of files that are not included in the bundle can be a major source of performance problems for compiler plugins. Although this new API is only available in Meteor 1.8, you can use inputFile.supportsLazyCompilation to determine dynamically whether the new API is available, so you can support older versions of Meteor without having to publish multiple versions of your package. [PR

      9983](https://github.com/meteor/meteor/pull/9983)

    • 🆕 New React-based Meteor applications can now be created using the command

      meteor create --react new-react-app
      

      Though relatively simple, this application template reflects the ideas of many contributors, especially @dmihal and @alexsicart, and it will no doubt continue to evolve in future Meteor releases. Feature #182 PR #10149

    • 📦 The .meteor/packages file supports a new syntax for overriding problematic version constraints from packages you do not control.

    If a package version constraint in .meteor/packages ends with a ! character, any other (non-!) constraints on that package elsewhere in the application will be weakened to allow any version greater than or equal to the constraint, even if the major/minor versions do not match.

    For example, using both CoffeeScript 2 and practicalmeteor:mocha used to be impossible (or at least very difficult) because of this api.versionsFrom("1.3") statement, which unfortunately constrained the coffeescript package to version 1.x. In Meteor 1.8, if you want to update coffeescript to 2.x, you can relax the practicalmeteor:mocha constraint by putting

      [email protected]_1! # note the !
    

    in your .meteor/packages file. The coffeescript version still needs to be at least 1.x, so that practicalmeteor:mocha can count on that minimum. However, practicalmeteor:mocha will no longer constrain the major version of coffeescript, so [email protected]_1 will work.

    Feature #208 Commit 4a70b12e Commit 9872a3a7

    • ⬆️ The npm package has been upgraded to version 6.4.1, and our fork of its pacote dependency has been rebased against version 8.1.6.

    • ⚡️ The node-gyp npm package has been updated to version 3.7.0, and the node-pre-gyp npm package has been updated to version 0.10.3.

    • Scripts run via meteor npm ... can now use the meteor command more safely, since the PATH environment variable will now be set so that meteor always refers to the same meteor used to run meteor npm. PR #9941

    • Minimongo's behavior for sorting fields containing an array is now compatible with the behavior of Mongo 3.6+. Note that this means it is now incompatible with the behavior of earlier MongoDB versions. PR #10214

    • ⚡️ Meteor's self-test has been updated to use "headless" Chrome rather than PhantomJS for browser tests. PhantomJS can still be forced by passing the --phantom flag to the meteor self-test command. PR #9814

    • Importing a directory containing an index.* file now works for non-.js file extensions. As before, the list of possible extensions is defined by which compiler plugins you have enabled. PR #10027

    • Any client (modern or legacy) may now request any static JS or CSS web.browser or web.browser.legacy resource, even if it was built for a different architecture, which greatly simplifies CDN setup if your CDN does not forward the User-Agent header to the origin. Issue #9953 PR #9965

    • Cross-origin dynamic import() requests will now succeed in more cases. PR #9954

    • Dynamic CSS modules (which are compiled to JS and handled like any other JS module) will now be properly minified in production and source mapped in development. PR #9998

    • 🔀 While CSS is only minified in production, CSS files must be merged together into a single stylesheet in both development and production. This merging is cached by standard-minifier-css so that it does not happen on every rebuild in development, but not all CSS minifier packages use the same caching techniques. Thanks to 1ed095c36d, this caching is now performed within the Meteor build tool, so it works the same way for all CSS minifier packages, which may eliminate a few seconds of rebuild time for projects with lots of CSS.

    • ⚡️ The meteor-babel npm package used by babel-compiler has been updated to version 7.1.0. Note: This change requires also updating the @babel/runtime npm package to version 7.0.0-beta.56 or later:

      meteor npm install @babel/runtime@latest
      

      meteor-babel issue #22

    • The @babel/preset-env and @babel/preset-react presets will be ignored by Meteor if included in a .babelrc file, since Meteor already provides equivalent/superior functionality without them. However, you should feel free to leave these plugins in your .babelrc file if they are needed by external tools.

    • ⚡️ The install npm package used by modules-runtime has been updated to version 0.12.0.

    • ⚡️ The reify npm package has been updated to version 0.17.3, which introduces the module.link(id, {...}) runtime method as a replacement for module.watch(require(id), {...}). Note: in future versions of reify and Meteor, the module.watch runtime API will be removed, but for now it still exists (and is used to implement module.link), so that existing code will continue to work without recompilation.

    • 📦 The uglify-es npm package used by minifier-js has been replaced with [email protected], a fork of uglify-es that appears to be (more actively) maintained. Issue #10042

    • ⚡️ Mongo has been updated to version 4.0.2 and the mongodb npm package used by npm-mongo has been updated to version 3.1.6. PR #10058 Feature Request #269

    • 🔌 When a Meteor application uses a compiler plugin to process files with a particular file extension (other than .js or .json), those file extensions should be automatically appended to imports that do not resolve as written. However, this behavior was not previously enabled for modules inside node_modules. Thanks to 8b04c25390, the same file extensions that are applied to modules outside the node_modules directory will now be applied to those within it, though .js and .json will always be tried first.

    • As foreshadowed in this talk about Meteor 1.7's modern/legacy bundling system (slides), Meteor now provides an isomorphic implementation of the WHATWG fetch() API, which can be installed by running

      meteor add fetch
      

      This package is a great demonstration of the modern/legacy bundling system, since it has very different implementations in modern browsers, legacy browsers, and Node. PR #10029

    • The bundle-visualizer package has received a number of UI improvements thanks to work by @jamesmillerburgess in PR #10025. Feature #310

    • Sub-resource integrity hashes (sha512) can now be enabled for static CSS and JS assets by calling WebAppInternals.enableSubresourceIntegrity(). PR #9933 PR #10050

    • The environment variable METEOR_PROFILE=milliseconds now works for the build portion of the meteor build and meteor deploy commands. Feature #239

    • 🔌 Babel compiler plugins will now receive a caller option of the following form:

      { name: "meteor", arch }
      

      where arch is the target architecture, e.g. os.*, web.browser, web.cordova, or web.browser.legacy. PR #10211