Multiple Webpack configs in .config file breaking app -


i have project job host react component export npm module. there 2 goals. running host project develop , test component i'm creating module. , transpile component/module down vanilla js such can imported via require() in other project.

for 2 purposes have following webpack config:

var path = require("path"); var webpack = require("webpack"); const htmlwebpackplugin = require("html-webpack-plugin");  var projectconfig = {    name: "project",   entry: "./src/index.js",   output: {     path: path.resolve(__dirname, "dist"),     filename: "bundle.js"   },    module: {     loaders: [       {         test: /\.js$/,         exclude: /node_modules/,         loader: "babel-loader",         query: {           presets: ["react", "es2015", "stage-2"],           plugins: ["transform-class-properties"]         }       },       {         rules: [           {             test: /\.css$/,             use: ["style-loader", "css-loader"]           }         ]       }     ]   },    devserver: { historyapifallback: true },   plugins: [     new htmlwebpackplugin({ title: "example", template: "./index.html" })   ] }  var waveformvisualizerconfig = {   name: "waveformvisualizer",   entry: "./src/components/waveformvisualizer.js",   output: {     path: path.resolve(__dirname, "package"),     filename: "index.js",     library: "waveformvisualizerlib",     librarytarget: "commonjs"   },   module: {     loaders: [       {         test: /\.js$/,         exclude: /node_modules/,         loader: "babel-loader",         query: {           presets: ["react", "es2015", "stage-2"],           plugins: ["transform-class-properties"]         }       }     ]   } };  module.exports = [waveformvisualizerconfig, projectconfig]; 

so 2 separate configs 2 separate (and loosely related) webpack compilations. first webpacking project bundle can load in browser. second transpiling react component (the module i'm developing) commonjs friends bundle file can npm install in other projects.

each config works on own. when try this: module.exports = [waveformvisualizerconfig, projectconfig];, project no longer works. specifically, there console.log's in web apps index.js file no longer appear in console. if switch webpack config module.exports = projectconfig, i'll see console.logs in chrome console.

from have read, supported set array of config objects on module.exports property webpack's config file uses. have overlooked else?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -