Skip to content

Commit

Permalink
Merge pull request #79 from roblan/fix/externals
Browse files Browse the repository at this point in the history
fix: add dependecies to externals
  • Loading branch information
mprzodala authored May 5, 2020
2 parents b356f1f + 329fbeb commit 4a6bb0c
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions webpack-prod.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
var webpack = require('webpack');
var path = require('path');
const path = require('path');
const pkg = require('./package.json');

module.exports = {
const externals = new Set([
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]);

const config = {
entry: {
main: "./src/index.js",
Bootstrap: "./src/components/styled/Bootstrap.js",
Separate: "./src/components/separate/index.js",
AutocompleteField: "./src/components/AutocompleteField.jsx",
FormController: "./src/components/FormController.js"
main: './src/index.js',
Bootstrap: './src/components/styled/Bootstrap.js',
Separate: './src/components/separate/index.js',
AutocompleteField: './src/components/AutocompleteField.jsx',
FormController: './src/components/FormController.js',
},
output: {
path: path.join(__dirname, ''),
filename: "[name].js",
libraryTarget: "umd"
filename: '[name].js',
libraryTarget: 'umd',
},
externals(context, request, callback) {
if (externals.has(request)) {
return callback(null, `${config.output.libraryTarget} ${request}`);
}
return callback();
},
resolve: {
extensions: ['.js', '.jsx']
extensions: ['.js', '.jsx'],
},
module: {
rules: [
Expand All @@ -41,6 +52,8 @@ module.exports = {
]
},
devServer: {
historyApiFallback: true
}
};
historyApiFallback: true,
},
};

module.exports = config;

0 comments on commit 4a6bb0c

Please sign in to comment.