UNPKG

six-widget-buildsupport

Version:

SIX Widgets buildsupport

51 lines (46 loc) 1.32 kB
const path = require('path'); const webpack = require('webpack'); // we pick up package.json for the *package we want do build* const packageDir = path.resolve('.') const packageJSON = require(path.join(packageDir,'package.json')) console.log('Building bundle with SDK for package in',packageDir) // make sure we define NODE_ENV, used by React const nodeEnvPlugin = new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }) module.exports = { entry: [ "./bundles/browser-bundle-with-sdk.js" ], output: { publicPath: 'dist/', path: path.join(packageDir,'dist'), filename: packageJSON.name+'-with-sdk.min.js' }, module: { rules: [ { test: [/\.js$/,/\.jsx$/], include: [ path.join(packageDir, 'bundles'), path.join(packageDir, 'src')], loader: 'babel-loader', options: { presets: ["es2015","react"], plugins: [ ['transform-css-require'], ['transform-object-rest-spread'], ['transform-class-properties'], ['transform-object-assign']] } } ] }, externals: { "react": "React", "react-dom": "ReactDOM" }, resolve: { extensions: ['.js', '.jsx'] }, devtool: 'source-map', plugins: [nodeEnvPlugin] };