Skip to content

Add HtmlWebpackPlugin publicPath and hash to the options #17

@blephy

Description

@blephy

Hi,

Seems the plugin doesn't work properly when the webpack publicPath is set.

Example :

When publicPath is set to /apps, all asset links added by HtmlWebpackPlugin are like href="/apps/...". But this plugin does not taken into account this to resolve the assets path in the build directory.

Error: Error: file "/apps/resources/css/app.595231d177672ceff686.css" not found in "/Users/allan.dolle/projects/lifen/lifen-core-apps/packages/client/build". Specify base path.

You should taken into account the webpack publicPath and remove it with a regexp from the path to resolve.

Furthermore, when HtmlWebpackPlugin has the hash: true option enabled to add an hash to the href (href=".../.../mycss.css?9786786979" the plugin does not work too, seems penthouse can't resolve the requested resource.

ErrorEvent {
  target: WebSocket {
    _events: [Object: null prototype] { open: [Function], error: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    readyState: 3,
    protocol: '',
    _binaryType: 'nodebuffer',
    _closeFrameReceived: false,
    _closeFrameSent: false,
    _closeMessage: '',
    _closeTimer: null,
    _closeCode: 1006,
    _extensions: {},
    _receiver: null,
    _sender: null,
    _socket: null,
    _isServer: false,
    _redirects: 0,
    url: 'ws://127.0.0.1:55981/devtools/browser/c7739f7d-f1e8-4707-a7df-af6058093203',
    _req: null,
    [Symbol(kCapture)]: false
  },
  type: 'error',
  message: 'socket hang up',
  error: Error: socket hang up
      at connResetException (internal/errors.js:628:14)
      at Socket.socketOnEnd (_http_client.js:499:23)
      at Socket.emit (events.js:412:35)
      at endReadableNT (internal/streams/readable.js:1317:12)
      at processTicksAndRejections (internal/process/task_queues.js:82:21) {
    code: 'ECONNRESET'
  }
}

And another improvement, seems this plugin is converting link defer attributes of js files. After adding this plugin, all my js link are <link defer="" src... /> instead of <link defer src... />.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions