Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build building with system url path #7

Closed
jordaofranca opened this issue May 20, 2017 · 9 comments
Closed

npm run build building with system url path #7

jordaofranca opened this issue May 20, 2017 · 9 comments

Comments

@jordaofranca
Copy link

When I run npm run build the sw.js is generated with system paths to the archives:

"C:/Users/jordao/projects/compra/build/1.chunk.82189a4e17c69863082e.js"

instead of:

"1.chunk.82189a4e17c69863082e.js"

@developit
Copy link
Member

Ah yeah. I think something needs to tell the sw plugin what webpacks context directory was.

@stevenfitzpatrick
Copy link

stevenfitzpatrick commented May 20, 2017

I remember using "stripPrefixMulti" in sw-precache plugin to fix this

new SWPrecacheWebpackPlugin({
    cacheId: pkg.name,
    filename: 'sw.js',
    minify: true,
    maximumFileSizeToCacheInBytes: 4194304,
    stripPrefixMulti: {
      'C:/dev/site/dist': '',
      '/home/travis/build/myname/site/dist': ''
    }
  }),

@developit
Copy link
Member

I think we can even just pass it process.cwd()

@lukeed
Copy link
Member

lukeed commented May 20, 2017

You can also access webpack's root, although I can't remember what it's called now.

@developit
Copy link
Member

yup yup. just figured we'd keep this bit generic since there might be a time when we want to support an "eject" feature.

@jordaofranca
Copy link
Author

jordaofranca commented May 20, 2017

Can we change it to this?

new SWPrecacheWebpackPlugin({
	filename: 'sw.js',
	navigateFallback: 'index.html',
	minify: true,
	staticFileGlobsIgnorePatterns: [
		/\.map$/,
		/push-manifest\.json$/
	],
	stripPrefixMulti: {
		 [process.cwd()]: ''
	 }
})

@NekR
Copy link

NekR commented May 20, 2017

Oh, if there only was a plugin which can do all that automatically. It would be such a bless 😎 😂

@developit
Copy link
Member

I believe this was fixed in 1.1.1?

@rkostrzewski
Copy link
Collaborator

Indeed it was, absolute paths are no longer there. Closing.

prateekbh pushed a commit that referenced this issue Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants