Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Compilation hangs if there are errors in sw.js #19

Closed
anilshanbhag opened this issue Feb 2, 2017 · 6 comments
Closed

Compilation hangs if there are errors in sw.js #19

anilshanbhag opened this issue Feb 2, 2017 · 6 comments
Labels

Comments

@anilshanbhag
Copy link

It would be good if compilation errors were displayed when there are errors in sw.js. Currently, it just hangs.

@oliviertassinari
Copy link
Owner

That's a good point. Do you have an example of error that hang the compilation?

@anilshanbhag
Copy link
Author

anilshanbhag commented Feb 5, 2017

https://github.com/oliviertassinari/serviceworker-webpack-plugin/blob/master/docs/src/sw.js

If you just introduce a syntax error, say:

let assetsToCache = [
  ...assets,
  'fasd'
  './',
];

Also, if the project is setup with eslint, it would nice to apply the same.
Thanks for the work :)

@oliviertassinari
Copy link
Owner

oliviertassinari commented Mar 17, 2017

@anilshanbhag I have tried your example, here is what I have from webpack@2. It doesn't hang on my side. I'm closing until another reproduction test case is provided.

    ERROR in ./docs/src/sw.js
    Module build failed: SyntaxError: Unexpected token, expected , (20:2)

      18 |   ...assets,
      19 |   'fasd'
    > 20 |   './',
         |   ^
      21 | ];
      22 |
      23 | assetsToCache = assetsToCache.map((path) => {

@anilshanbhag
Copy link
Author

@oliviertassinari I am using it with Vue. I tried the example in docs and that does print out errors from service worker. However, when i use it with vue templates it doesn't (atleast it doesn't hang now). Steps to reproduce:

  1. Follow instructions here to create a dummy vue project: https://github.com/vuejs-templates/webpack.
  2. Include the service worker plugin in package.json. Add a simple sw.js in src/ folder. Register plugin in `build/webpack.dev.conf
    new ServiceWorkerWebpackPlugin({
      entry: path.join(__dirname, '../src/sw.js'),
      excludes: [
        '**/.*',
        '**/*.map',
        '*.html',
      ],
    }),

I have been using the plugin for a while and making sure the service worker compiles at each step. However just happened to code for an hour and now I have been debugging for nearly an hour trying to isolate where the js error is :/ Would be of great help if the plugin reported errors like it does in the example.

@oliviertassinari
Copy link
Owner

Thanks for the reproduction example. I don't have time to look into it but I'm reopening so someone could.

@anthonator
Copy link

This seems related to #29

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants