diff --git a/.gitignore b/.gitignore index 77e759d2..3e2e84b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -bower_components/ build/ node_modules/ diff --git a/README.md b/README.md index 0c169694..47a36685 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Second, install [Bower](https://bower.io/) using [npm](https://www.npmjs.com) This command serves the app at `http://127.0.0.1:8081` and provides basic URL routing for the app: - polymer serve --module-resolution=node --npm + polymer serve ### Build @@ -86,12 +86,12 @@ Builds will be output to a subdirectory under the `build/` directory as follows: build/ es5-bundled/ es6-bundled/ - es6-unbundled/ + esm-bundled/ ``` * `es5-bundled` is a bundled, minified build with a service worker. ES6 code is compiled to ES5 for compatibility with older browsers. * `es6-bundled` is a bundled, minified build with a service worker. ES6 code is served as-is. This build is for browsers that can handle ES6 code - see [building your project for production](https://www.polymer-project.org/2.0/toolbox/build-for-production#compiling) for a list. -* `es6-unbundled` is an unbundled, minified build with a service worker. ES6 code is served as-is. This build is for browsers that support HTTP/2 push. +* `esm-bundled` is a bundled, minified build with a service worker. It uses standard ES module import/export statements for browsers that support them. Run `polymer help build` for the full list of available options and optimizations. Also, see the documentation on the [polymer.json specification](https://www.polymer-project.org/2.0/docs/tools/polymer-json) and [building your Polymer application for production](https://www.polymer-project.org/2.0/toolbox/build-for-production). @@ -99,7 +99,7 @@ Run `polymer help build` for the full list of available options and optimization This command serves your app. Replace `build-folder-name` with the folder name of the build you want to serve. - polymer serve --module-resolution=node --npm build/build-folder-name/ + polymer serve build/build-folder-name/ ### Run tests diff --git a/polymer.json b/polymer.json index 4899e787..73293df3 100644 --- a/polymer.json +++ b/polymer.json @@ -1,33 +1,74 @@ { "entrypoint": "index.html", - "shell": "src/my-app.html", - "fragments": [ - "src/my-view1.html", - "src/my-view2.html", - "src/my-view3.html", - "src/my-view404.html" - ], + "shell": "src/my-app.js", "sources": [ - "images/**/*", - "src/**/*" + "images/**/*" ], "extraDependencies": [ - "bower_components/webcomponentsjs/*.js", - "!bower_components/webcomponentsjs/gulpfile.js", - "manifest.json" + "manifest.json", + "node_modules/@webcomponents/webcomponentsjs/*.js", + "!node_modules/@webcomponents/webcomponentsjs/gulpfile.js" ], - "lint": { - "rules": ["polymer-2"] - }, "builds": [ { - "preset": "es5-bundled" + "name": "esm-bundled", + "browserCapabilities": [ + "es2015", + "modules" + ], + "js": { + "minify": true + }, + "css": { + "minify": true + }, + "html": { + "minify": true + }, + "bundle": { + "inlineScripts": false + }, + "addServiceWorker": true }, { - "preset": "es6-bundled" + "name": "es6-bundled", + "browserCapabilities": [ + "es2015" + ], + "js": { + "minify": true, + "transformModulesToAmd": true + }, + "css": { + "minify": true + }, + "html": { + "minify": true + }, + "bundle": { + "inlineScripts": false + }, + "addServiceWorker": true }, { - "preset": "es6-unbundled" + "name": "es5-bundled", + "js": { + "minify": true, + "compile": true, + "transformModulesToAmd": true + }, + "css": { + "minify": true + }, + "html": { + "minify": true + }, + "bundle": { + "inlineScripts": false + }, + "addServiceWorker": true } - ] + ], + "moduleResolution": "node", + "npm": true } diff --git a/sw-precache-config.js b/sw-precache-config.js index 2b757a70..cd673cd3 100644 --- a/sw-precache-config.js +++ b/sw-precache-config.js @@ -1,6 +1,6 @@ /** * @license - * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. + * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt @@ -12,18 +12,13 @@ module.exports = { staticFileGlobs: [ - 'bower_components/webcomponentsjs/webcomponents-loader.js', 'manifest.json', + 'src/**/*', ], runtimeCaching: [ { - urlPattern: /\/bower_components\/webcomponentsjs\/.*.js/, - handler: 'fastest', - options: { - cache: { - name: 'webcomponentsjs-polyfills-cache', - }, - }, - }, + urlPattern: /\/@webcomponents\/webcomponentsjs\//, + handler: 'fastest' + } ], };