Merge pull request #2190 from resin-io/webpack-exclude-package

fix(webpack): Exclude package.json from UI bundle
This commit is contained in:
Jonas Hermsmeier 2018-04-10 17:42:38 +02:00 committed by GitHub
commit fdd26ba8f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,6 @@
'use strict'
const _ = require('lodash')
const path = require('path')
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
@ -40,8 +39,11 @@ module.exports = {
// on the tree (for testing purposes) or inside a generated
// bundle (for production purposes), by translating
// relative require paths within the bundle.
if (/\/(sdk|shared)/i.test(request)) {
return callback(null, `commonjs ../../../lib/${_.replace(request, /(\.\.\/)*/, '')}`)
if (/\/(sdk|shared)/i.test(request) || /package\.json$/.test(request)) {
const output = path.join(__dirname, 'generated')
const dirname = path.join(context, request)
const relative = path.relative(output, dirname)
return callback(null, `commonjs ${path.join('..', '..', relative)}`)
}
return callback()