Giter VIP home page Giter VIP logo

pwa's Introduction

PWA

WORK IN PROGRESS


Features

  • Framework Agnostic
    Build with your preferred framework or with none at all!
    Official presets for Preact, React, Vue, and Svelte.

  • Plug 'n Play
    Don't worry about configuration, unless you want to.
    Presets and plugins are automatically applied. Just install and go!

  • Fully Extensible
    Includes a plugin system that allows for easy, fine-grain control of your configuration... when needed.

  • Feature Rich
    Supports Babel, Bublé, Browserslist, TypeScript, PostCSS, ESLint, Prettier, and Service Workers out of the box!

  • Instant Prototyping
    Quickly scaffold new projects with your preferred view library and toolkit.
    Kick it off with a perfect Lighthouse score!

  • Static Site Generator
    Export your routes as "pre-rendered" HTML.
    Great for SEO and works on any static hosting service.

Installation

PWA is split up into two main components (core and cli) in addition to its list of presets and plugins.

While most will opt for the CLI, the core module handles all configuration and can be used as a standalone module.

Please refer to each package for installation, API, and Usage information.

Quick Start

# Install globally
$ npm install --global @pwa/cli
# OR
$ yarn global add @pwa/cli

# Display CLI's help text
$ pwa --help

# Generate new project
$ pwa init

Note: The global modifiers are only required for global command-line usage!
Local devDependency installation will also work, but then pwa usage is limited to the project.

Concepts

Please read about Progressive Web Apps if the term is unfamiliar to you.

Presets

Presets are collections of plugins that are tailored for a particular framework.

While there may be "official" presets, this does not mean that PWA can only support these candidates! The current options are:

These packages are auto-loaded during PWA's initialization and are applied first, before any Plugins or custom configuration. This means that you always have the option to override a value or setting shipped within the Preset.

Plugins

Plugins are (typically) individual features or chunks of configuration that are encapsulated for easy/automatic application within your build process.

While there may be "official" plugins, this does not mean that PWA can only support these functionalities! The current plugins include:

These packages are auto-loaded during PWA's initialization and are applied second, after any Presets and before custom configuration. This allows Plugins to override settings from Presets.

Plugins may (sometimes) expose a new key on the config tree and then reference this value later in composition. This allows the end-user to change the Plugin's settings before running the build.

Please see @pwa/plugin-critters for an example of this practice.

Commands

This section applies to @pwa/cli specifically.

Build

Build your application for production

$ pwa build --help

  Description
    Build production assets

  Usage
    $ pwa build [src] [options]

  Options
    --analyze     Launch interactive Analyzer to inspect production bundle(s)
    -o, --dest    Path to output directory  (default build)
    -h, --help    Displays this message

Export

Export routes' HTML for static hosting

Instead of --routes, you may define a routes array within pwa.config.js config file.

If no routes are defined in either location, PWA will traverse your "@pages"-aliased directory (default: src/pages/**) and attempt to infer URL patterns from the file structure.

In the event that no files exist within that directory, PWA will show a warning but still scrape the index ("/") route.

$ pwa export --help

  Description
    Export pre-rendered pages

  Usage
    $ pwa export [src] [options]

  Options
    -o, --dest        Path to output directory  (default build)
    -w, --wait        Time (ms) to wait before scraping each route  (default 0)
    -r, --routes      Comma-delimited list of routes to export
    -i, --insecure    Launch Chrome Headless without sandbox
    -h, --help        Displays this message

Important: Using export requires a local version of Chrome installed! See chrome-launcher.
Additionally, the --insecure flag launches Chrome without sandboxing. See here and here for help.

Watch

Develop within a live-reload server

Within your pwa.config.js's webpack config, any/all devServer options are passed to Webpack Dev Server.

$ pwa watch --help

  Description
    Start development server

  Usage
    $ pwa watch [src] [options]

  Options
    -H, --host     A hostname on which to start the application  (default localhost)
    -p, --port     A port number on which to start the application  (default 8080)
    -q, --quiet    Disable logging to terminal, including errors and warnings
    --https        Run the application over HTTP/2 with HTTPS
    --key          Path to custom SSL certificate key
    --cert         Path to custom SSL certificate
    --cacert       Path to custom CA certificate override
    -h, --help     Displays this message

Build vs Export

Export can be thought of as "Build 2.0" — it spins up a Headless Chrome browser and programmatically scrapes your routes.

This is ideal for SEO, PWA behavior, and all-around performance purposes, as your content will exist on the page before the JavaScript application is downloaded, parsed, boots, and (finally) renders the content.

The generated HTML pages will be placed in your build directory. A /login route will be exported as build/login/index.html — this makes it compatible with even the "dumbest" of static hosting services!

Note: Running export will automatically run build before scraping.

Configuration

Overview

All configuration within the PWA tree is mutable! Presets, Plugins, and your custom config file write into the same object(s). This is great for composability and extensibility, but be warned that your custom config may break the build if you're not careful.

💡 Official presets & plugins are controlled releases and are ensured to play nicely with one another.

The config object(s) for your project are assembled in this sequence:

  1. Presets: All non-webpack config keys
  2. Plugins: All non-webpack config keys
  3. Custom: All non-webpack config keys
  4. Presets: The webpack config key, if any
  5. Plugins: The webpack config key, if any
  6. Custom: The webpack config key, if any

Because the final config object is passed to Webpack, internally, the webpack key always runs last as it composes & moves everything into its relevant loaders, plugins, etc.

Important: When defining a custom webpack key it must always be a function!

Mutations

Every config key can be defined or mutated in the same way!

Any non-Function key will overwrite the existing value. This allows strong opinions and/or allows a Plugin to define a new config key and reference it later on.

Any Function key will receive the existing, matching config-value for direct mutation. This is for fine-grain control over the existing config.

// defaults:
exports.hello = { foo:1, bar:2 };
exports.world = ['How', 'are', 'you?'];

// preset/plugin/custom:
exports.hello = function (config) {
  config.bar = 42;
  config.baz = [7, 8, 9];
}
exports.world = ['I', 'am', 'fine'];
exports.HOWDY = 'PARTNER!';

// result:
exports.hello = {
  foo: 1,
  bar: 42,
  baz: [7, 8, 9]
}
exports.world = ['I', 'am', 'fine'];
exports.HOWDY = 'PARTNER!';

Functions

Any config key that is a function will have the signature of (config, env, opts).

config

Type: Mixed

This will be the existing value for the current key. It will typically be an Object, but not always.

It will also be undefined if/when defining a new config key — if you know that to be the case, you shouldn't be using a Function~!

env

Type: Object

Will be the environmental values for this command.
This is passed from @pwa/core's options.

The env.cwd, env.src, env.dest, env.log, env.production and env.webpack keys are always defined.
Anything else is contextual information for the current command being run.

opts

Type: Object

Direct access to configuraton keys, except webpack.

As an example, this can be used within a Plugin for gaining insight or gaining access to other packages' settings.

The default config keys (except webpack) will always be present here.

Config Keys

The following keys are defined by default within every PWA instance. You may mutate or compose with them accordingly.

babel

Type: Object
Default: Link

Your Babel config object.

css

Type: Object
Default: Link

Core CSS behavior — see css-loader for options.

html

Type: Object
Default: Link

Your HTML plugin configuration — see html-webpack-plugin for options.

less

Type: Object
Default: Link

Any less-loader options — see less-loader for documentation.

Note: This is the entire loader config; you may need to include the lessOptions nested object.

postcss

Type: Object
Default: Link

Your PostCSS config — you may also use any config file/method that postcss-loader accepts.

Important: The postcss.plugins key cannot be a function!

sass

Type: Object
Default: Link

Any sass-loader options — see sass-loader for documentation.

This object will be used for both .scss and .sass file extensions.
The .sass extension will automatically enforce the indentedSyntax option.

Note: This is the entire loader config; you may need to include the sassOptions nested object.

stylus

Type: Object
Default: Link

Any stylus-loader options — see stylus-loader for documentation.

terser

Type: Object
Default: Link

The options for Terser Plugin.

Note: Expecting UglifyJS? It's no longer maintained!
The Terser configuration is nearly identical – simply rename uglifyOptions to terserOptions 👍

webpack

Type: Function

The main handler for all of PWA!
When you define a custom webpack, you are not overriding this function. Instead, you are manipulating Webpack's config immediately before PWA executes the build.

Browserslist

The preferred method for customizing your browser targets is thru the browserslist key within your package.json file.

Note: When creating a new project with pwa init, our recommended config is automatically added for you!

You may choose to change the default values, or use any configuration method that Browserslist accepts.

The resulting array of browser targets will be automatically applied to Autoprefixer, Babel, Bublé, PostCSS, Stylelint, ...etc.

Customizing

Presets and Plugins are just encapsulated config mutations — that's it!

Now, if you want to further customize your PWA build, beyond what your installed Presets & Plugins are giving you, then you can create a pwa.config.js in your project's root directory.

Note: Your new pwa.config.js file should sit alongside your package.json 👍

With this file, you may mutate or compose any of the config keys that either PWA or its Plugins exposes to you.

Here is an example custom config file:

// pwa.config.js
const OfflinePlugin = require('offline-plugin');

// Mutate "@pwa/plugin-eslint" config
exports.eslint = function (config) {
  config.formatter = require('eslint-friendly-formatter');
};

// Add new PostCSS Plugin
exports.postcss = function (config) {
  config.plugins.push(
    require('postcss-flexbugs-fixes')
  );
};

// Export these pages during "pwa export" command
exports.routes = ['/login', '/register', '/articles/hello-world'];

// Update Webpack config; ENV-dependent
exports.webpack = function (config, env) {
  let { production, webpack } = env;

  if (production) {
    config.plugins.push(
      new OfflinePlugin(),
      new webpack.DefinePlugin({
        MY_API: JSON.stringify('https://api.example.com')
      })
    );
  } else {
    config.devServer.https = true;
    config.plugins.push(
      new webpack.DefinePlugin({
        MY_API: JSON.stringify('http://staging.example.com')
      })
    );
  }
};

Credits

A huge thank-you to Jimmy Moon for donating the @pwa organization on npm! 🙌 Aside from being the perfect name, we wouldn't be able to have automatic preset/plugin resolution without a namespace!

Incredible thanks to the giants whose shoulders this project stands on~! ❤️

PWA was originally conceived in 2016 but at that time, it wasn't yet possible to build it with the feature set I had in mind. Since then, an amazing amount of work has been done on Webpack and its ecosystem, which now makes the project goals feasible.

There's no question that PWA takes inspiration from popular CLI applications, like Preact CLI, Vue CLI, and Create React App. They most definitely paved the way. I've used, learned from, and refined my wishlist over years while using these tools. Despite their greatness, I still found a need for a universal, framework-agnostic PWA builder that could unify all these great libraries.

License

MIT © Luke Edwards

pwa's People

Contributors

lukeed avatar olso avatar sapegin avatar voidao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwa's Issues

Export to relative paths?

Right now pwa export exports to an absolute path (root). Which config do I need to generate relative paths?

Add `*-router` templates

Stupid/simple ones at the very least.

Got caught up in making polished demos to match / build from the single-page scaffold.

ServiceWorker Plugins

  • Offline Plugin
  • SW Precache
  • SW Workbox

ServiceWorker already works thru manual webpack config mgmt...

// pwa.config.js
const SWPrecache = require('sw-precache-webpack-plugin');

exports.webpack = function (config, env) {
  if (env.production) {
    config.plugins.push(
      new SWPrecache({ ... })
    );
  }
}

... but it'd be nice to have this done automatically, just because the plugin(s) exist.

Hot Module Reloading doesn't work out of the box?

I ran pwa init and created a new React app. Then I ran pwa serve which output:

λ pwa watch
[PWA] Applying preset: @pwa/preset-react
[PWA] Starting development server on http://localhost:8080
[PWA] Rebuilt in 4.77s

After I modified one of the React component, it said:

[PWA] File changed: src\components\App\index.js
[PWA] Rebuilt in 1.60s

And I saw this in the browser console:

[WDS] App updated. Recompiling...
[WDS] App hot update...

However the page wasn't hot-reloaded and I had to refresh to see the changes.

Is that expected?

Windows 10.0.17134.228
Firefox 61.0.2

[question] can we run critters after export?

From what I observe, pwa export will use chrome to pre-render all pages (default) with css classes and everything. So running critter after this point make more sense right?

TypeScript Plugin

  • Should include .tsx? as module extension
  • Should swap out babel-loader for itself
  • Should expect typescript config key?
    The standard TS config/rc file already works.

I think there may need to be separate @pwa/plugin-{preset}-typescript plugins for (React/Vue/etc)-specific handling of TypeScript. Same goes with test suite(s).

Watch: `--https` flag overrides custom config

i have this line in pwa.config.js

config.devServer.https = true

however, when i browse to https://localhost:8080 it shows ERR_SSL_PROTOCOL_ERROR

Do you have any idea why it happens? should i bring this to webpack devserver repo instead?

Customize SSR

Hi @lukeed,

Thanks for this amazing project, it sounds really exciting :)

I'm playing a little bit with it and I'm wondering if there's a technique to customise the way the pages are server rendered?

For instance, in projects like Razzle, you have access to a server.js file where you can customize the code. With this approach, you can support libraries like styled-components, Apollo etc...

Currently, I don't see anything in the doc that could support that. Did I miss something or is there a plan to support that in the future?

Browserslist config

Right now we have browsers option in config. And we pas it to Babel and Autoprefixer.

Unfortunately, Babel and Autoprefixer are not the only Browserslist clients. optimize-css-assets-webpack-plugin (CSS minifier which is used in this project) uses Browserslist too. Also there is many PostCSS plugins, ESLint plugins and Stylleint plugins, which use Browserslist too.

I think the only way here is to keep target browsers in standard place — .browserslistrc or browserslist key in package.json.

Migration plan:

  1. Add "browserslist": ["defaults"] to package.json generator
  2. Add warning on config.browsers, which will ask users to move browsers.
  3. In next major version, throw a error on config.browsers

What do you think? Yeap, I know it is always bad news when cool API faced problems like this.

export fails in container, connecting to different port than the start port

I'm not sure why the server started on port 36573 but somehow, it's connecting to 33435

I'm having this issue in container though, not on my local machine.

[PWA] Started local server on http://localhost:36573
(node:6) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:33435
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled willterminate the Node.js process with a non-zero exit code.

PWA command not found on local install

Would like to try PWA but I get the following from a local install:

$ pwa --help
No command 'pwa' found, did you mean:
Command 'paw' from package 'paw-common' (universe)
Command 'pca' from package 'eigensoft' (multiverse)
Command 'bwa' from package 'bwa' (universe)
Command 'pda' from package 'speech-tools' (universe)
Command 'pwd' from package 'coreutils' (main)
Command 'pia' from package 'pia' (universe)
Command 'poa' from package 'poa' (universe)
Command 'pua' from package 'pglistener' (universe)
pwa: command not found

Dynamic Init Choices

Should only show certain choices within pwa init based on certain pre-conditions:

  • Show Buble in "Features" when preset == none
  • Show TSLint in "Linter/Formatter" when TypeScript selected

> Blocked by terkelg/prompts#88

Feat: Use webpack-chain?

Currently the presets use direct assign, I think adding webpack-chain might make it even more reliable?

[question] how to build with development mode

pwa build is always set to production mode

suppose i want to do a development build with a different variable in DefinePlugin of webpack. How can I do that?

if (production) {
        config.plugins.push(
            new webpack.DefinePlugin({
                MY_API_URL: JSON.stringify('https://api.example.com')
            })
        )
    }
    else {
        config.devServer.https = true

        config.plugins.push(
            new webpack.DefinePlugin({
                MY_API_URL: JSON.stringify('https://devapi.example.com')
            })
        )
    }

Export: Print "wrote" sooner

Print each [PWA] Wrote file: /contact/index.html sequentially (in chain) rather than all at once.

With a --wait timer, you can easily get 10+ seconds of what feels like unresponsiveness.

[question] import css from module

i'm using a library and it requires me to load some css like this import 'react-day-picker/lib/style.css';

I'm using pwa with preact preset and sass. however, adding the above doesn't import the css for me.

I'm reading pwa/core but couldn't figure it out.

Core: Optimize "assets" handling

Can easily check if the directory exists, and which files are in use within the tree (if any).

Can also output hash-based names for each asset... TBD

Detect if Yarn is in use

"pwa init" outputs the following:

      These commands have been added to your package.json already.
      We suggest you begin by typing:

        $ cd pwareacttest
        $ npm install
        $ npm run watch

However, If I'm using Yarn, it should suggest Yarn rather than npm. A system that has Yarn might not even have npm installed. create-react-app is an example of an app that detects if Yarn is being used.

ESLint Plugin

Attach eslint-loader safely, and expect config from .eslintrc (default) or a eslint config key.

Electron?

Looking to build an svelte electron app without worrying much about config, thought this might be a good starting point, anyone tried it with electron yet or is it possible? Had it somewhat working but ran into issues with routing in the prod build.

[question] pwa.config.js override breaks pwa build

I'm not sure if this is the expected behavior.

take preact for example, there are a bunch of default resolve.alias for webpack. as soon as i add more alias, the other default, required aliases were gone, leaving pwa build to fail.

                'react': 'preact-compat',
		'react-dom': 'preact-compat',
		'preact': opts.production ? 'preact/dist/preact.min.js' : 'preact',
		'react-addons-css-transition-group': 'preact-css-transition-group',
		'create-react-class': 'preact-compat/lib/create-react-class'

i have to copy them and add to my override config to make it work.

`${framwork}` support

Would this package accept PRs with support for @pwa/preset-${framework}? I see you have two open issues for other larger frameworks but I'm thinking slightly smaller ones. HyperApp, Elm, Aurelia and so on.

Better Error formatting

Nitpick, but getting tired of webpack-format-messages formatting. Would much rather something more elegantly formatted & trimmed.

Applies to watch and build outputs.

Don't use "latest" in package.json

It's a bad idea to use "latest" in the generated package.json like this:

  "dependencies": {
    "ganalytics": "latest",
    "react": "latest",
    "react-dom": "latest",
    "sirv-cli": "latest"
  },
  "devDependencies": {
    "@pwa/cli": "latest",
    "@pwa/preset-react": "latest"
  }

In particular, React sometimes has breaking API changes between versions, so the example app may not even work properly if a new major version of React is released!

This should instead lock it down to the semver minor release range (eg. ~1.2.0), and newer versions of pwa could bump the dependency versions once it's determined that the demo apps still work fine with the new versions (or people could bump them manually)

Creating new alias

Hello everyone,

I'm trying an experiment with React and I've changed the src folder to:

assets/
js/
styles/
index.html
index.js

The main reason of this is that I wanted to separate styles from javascripts, but now, the only way I can find my files, is using relative path ../styles/component/index.scss...

I already tried to do this on pwa.config.js:

const resolve = require('resolve');

exports.webpack = function(config, env) {
  config.resolve = {
    extensions: ['.js', '.jsx', '.json', '.scss', '.css', '.svg', '.pdf', '.zip', 'mp4', 'jpg', 'png'],
    alias: {
      styles: resolve(__dirname, 'src/styles'),
      js: resolve(__dirname, 'src/js'),
      assets: resolve(__dirname, 'assets')
    }
  };
};

But returns the error:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.resolve.alias should be one of these:
   object { <key>: string } | [object { alias?, name?, onlyModule? }]
   -> Redirect module requests
   Details:
    * configuration.resolve.alias['styles'] should be a string.
      -> New request
    * configuration.resolve.alias['js'] should be a string.
      -> New request
    * configuration.resolve.alias['assets'] should be a string.
      -> New request
    * configuration.resolve.alias should be an array:
      [object { alias?, name?, onlyModule? }]
    at webpack (/Users/guilhermeu/.config/yarn/global/node_modules/webpack/lib/webpack.js:24:9)
    at module.exports (/Users/guilhermeu/.config/yarn/global/node_modules/@pwa/core/index.js:64:12)
    at module.exports (/Users/guilhermeu/.config/yarn/global/node_modules/@pwa/cli/lib/watch.js:12:30)
    at Sade.parse (/Users/guilhermeu/.config/yarn/global/node_modules/sade/lib/index.js:153:56)
    at Object.<anonymous> (/Users/guilhermeu/.config/yarn/global/node_modules/@pwa/cli/bin.js:43:3)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Installation misses directories and files

npm init

✔ Which framework would you like to use? › React
✔ Select features needed for your project: › 
✔ Directory to use … .
✔ Are you sure you want to write into the current directory? … no
✔ OK. Please provide another directory. … test
(node:9360) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '~/.nvm/versions/node/v10.9.0/lib/node_modules/@pwa/cli/templates/assets'

Installation misses the following:

  • assets
  • css
  • index.html
  • .gitignore

(manually copying them solves the issue)

node -v 10.9.0
npm -v 6.4.1

Development server always start on port 80

Hi,

maybe I'm missing something, but on my system, with a fresh installation, running watch always try to bind to localhost:80 (I see the debug message [PWA] Starting development server on http://localhost:80.

I tried with pwa watch --port 9090 and with this pwa.config.js in the root of the project:

  config.devServer.port = 9090;
};```

My current setup:

OSX 10.10.5
node v8.11.0
npm 5.6.0

Thanks in advance!

Gennaro

Change default browsers

It is me again with the issue about Browserslist. Hope I didn’t bother you with it 😅

Current browsers are (according to Jamie’s article)

>0.25%, not ie 11, not op_mini all

Unfortunately, this article was not created with good analysis behind.

Here I bring developers around the world and they say that Jamie’s target browsers settings could cut the whole countries from the Internet
browserslist/browserslist#250

Personally, I see people use Opera Mini everyday here. In the streets, in cafes, in buses, everywhere you can think of.

Here are Browserslist’s official recommendations

  1. Select browsers directly (last 2 Chrome versions) only if you are making a web app for a kiosk with one browser. There are a lot of browsers on the market. If you are making general web app you should respect browsers diversity.
  2. If you want to change the default set of browsers we recommend to combine last 1 version, not dead with > 0.2% (or > 1% in US, > 1% in my stats). last n versions adds too many dead browsers and does not add popular old versions. > 0.2% make popular browsers even more popular, so we will have a monopoly and stagnation, as we had with Internet Explorer 6.
  3. Don’t remove browsers just because you don’t know them. Opera Mini has 100 million users in Africa and it is more popular in the global market than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox and desktop Safari altogether.

The default query defaults (or > 0.5%, last 2 versions, Firefox ESR, not dead) is very balanced. If you want to keep bundle smaller, but still be open for everyone in the world, I can suggest:

> 1%, last 1 version, not ie 11, not ie_mob 11, not dead

issue with offline-plugin

I got this issue with offline plugin. The link in the error recommends that i add this require('offline-plugin/runtime').install(); but i'm not sure where to add it .

OfflinePlugin: Plugin's runtime wasn't added to one of your bundle entries. See this https://goo.gl/YwewYp for details.

Angular

Add new @pwa/preset-angular package.

I'm super out of touch with Angular, so this will need some research.

How to subscribe css modules rule?

Hello, I need to remove the css generating with a hash on the end of each element.

How can I do that? I already tried just pushing into the rules but still not subscribe, the classes are still generating with hashes.

Code:

config.module.rules.push({
    test: /\.css$/,
    loader: 'css-loader',
    query: {
      modules: true,
      localIdentName: '[name]'
    }
  })

Evidence:
image

Polymer

Add new @pwa/preset-polymer package.

I'm super out of touch with Polymer world, so this will need some research.

Configure SourceMaps

Expose a --sourcemap (and --no-sourcemap) flag on pwa build that configures mapping existence/type.

Available options are tied to Webpack's devtool possibilities.

Right now, source-map is the enforced option for production. It can be disabled already, but only thru webpack config key:

// pwa.config.js

exports.webpack = function (config, env) {
  if (env.production) {
    config.devtool = false;
  }
}

Add "HMR" utility for Preact?

The React preset has a HMR utility that skips the module.hot and foo = render(.., foo) juggling.

Think it'd be nice if can get the same utility in for Preact apps.

Getting 404

Followed setup instructions. Open localhost:8080 in browser and get 404.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.