Commit 9cc6f414 by Ari Rizzitano

split the config

parent ebb009f7
......@@ -82,7 +82,8 @@
"style-loader": "^0.19.0",
"webpack": "^3.0.0",
"webpack-build-notifier": "^0.1.16",
"webpack-dev-server": "^2.4.4"
"webpack-dev-server": "^2.4.4",
"webpack-merge": "^4.1.0"
},
"jest": {
"setupFiles": [
......
const path = require('path');
const merge = require('webpack-merge');
const MinifyPlugin = require('babel-minify-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: {
polyfill: 'babel-polyfill',
main: path.resolve('./src/index.js'),
},
const scopedConfig = {
output: {
filename: 'dist/index.js',
library: 'paragon',
libraryTarget: 'umd',
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new ExtractTextPlugin('dist/paragon.min.css'),
new MinifyPlugin(),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['env', 'minify'],
},
},
{ loader: 'source-map-loader' },
],
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: [
......@@ -61,6 +40,36 @@ module.exports = {
},
],
},
};
const commonConfig = {
devtool: 'source-map',
entry: {
main: path.resolve('./src/index.js'),
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new MinifyPlugin(),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['env', 'minify'],
},
},
{ loader: 'source-map-loader' },
],
},
],
},
externals: [{
react: {
root: 'React',
......@@ -86,3 +95,7 @@ module.exports = {
},
}],
};
module.exports = [
merge(commonConfig, scopedConfig),
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment