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

Production build issue #16

Closed
ericbets opened this issue May 14, 2017 · 2 comments
Closed

Production build issue #16

ericbets opened this issue May 14, 2017 · 2 comments

Comments

@ericbets
Copy link

This works fine for me in dev mode, but production builds fail if I load
./index.html
./dist/index.html

from the browser. My url looks like: localhost/codepan and it's in /var/www/html/codepan

@zcong1993
Copy link
Sponsor Collaborator

You should use a subdomain or change poi.config.js as this:

const OfflinePlugin = require('offline-plugin')

module.exports = options => ({
  postcss: [
    require('postcss-nested'),
    require('postcss-property-lookup')
  ],
  extendWebpack(config) {
    // inject offline-plugin in production build
    if (options.mode === 'production') {
     config
        .output.publicPath('./')

      config.plugin('offline')
        .use(OfflinePlugin, [{
          caches: {
            main: [':rest:']
          },
          ServiceWorker: {
            events: true
          },
          AppCache: {
            events: true
          }
        }])
    }
  },
  production: {
    sourceMap: false
  }
})

@egoist
Copy link
Owner

egoist commented May 15, 2017

The simplest way is setting homepage: './' (works for all hash router) or homepage: '/codepan/' in your case, see https://poi.js.org/#/options?id=homepage

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

3 participants