From 19e4116904bce4457569e56ae6f9642513592191 Mon Sep 17 00:00:00 2001 From: Amelie Rosser Date: Fri, 8 Sep 2017 22:50:09 +0100 Subject: [PATCH] Updating webpack configs --- webpack.config.build.js | 37 ++++++++++++++++++++++--------------- webpack.config.examples.js | 14 +++++++++++--- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/webpack.config.build.js b/webpack.config.build.js index 89fa797..98ff4d1 100644 --- a/webpack.config.build.js +++ b/webpack.config.build.js @@ -1,49 +1,56 @@ -const path = require("path"); -const BabiliPlugin = require("babili-webpack-plugin"); +const path = require('path'); +const BabiliPlugin = require('babili-webpack-plugin'); -const production = process.env.NODE_ENV === "production"; +const production = process.env.NODE_ENV === 'production'; module.exports = { - entry: path.join(process.cwd(), "src/index.ts"), + entry: path.join(process.cwd(), 'src/index.ts'), + devtool: 'source-map', output: { - path: path.join(process.cwd(), "lib"), - filename: production ? "ixviii.medium.min.js" : "ixviii.medium.js", - libraryTarget: "commonjs2" + path: path.join(process.cwd(), 'lib'), + filename: production ? 'ixviii.medium.min.js' : 'ixviii.medium.js', + library: 'ixviii.medium', + libraryTarget: 'umd', + umdNamedDefine: true }, resolve: { - extensions: [".ts", ".js"] + extensions: ['.ts', '.js'] }, module: { loaders: [ { test: /\.ts$/, exclude: /node_modules/, - loader: "babel-loader!ts-loader" + loader: 'babel-loader!ts-loader' }, { test: /\.js$/, exclude: /node_modules/, - loader: "babel-loader", + loader: 'babel-loader', query: { presets: [ [ - "env", + 'env', { targets: { - browsers: ["last 2 versions", "ios_saf >= 8", "not IE <= 10"] + browsers: [ + 'last 2 versions', + 'ios_saf >= 10.2', + 'not IE <= 10' + ] } } ] ], - plugins: ["babel-plugin-transform-class-properties"] + plugins: ['babel-plugin-transform-class-properties'] } }, { test: /\.json$/, - loader: "json-loader" + loader: 'json-loader' } ] }, - stats: "minimal", + stats: 'minimal', plugins: production ? [new BabiliPlugin()] : [] }; diff --git a/webpack.config.examples.js b/webpack.config.examples.js index 8a7dd7d..25d44f9 100644 --- a/webpack.config.examples.js +++ b/webpack.config.examples.js @@ -1,5 +1,8 @@ const fs = require('fs'); const path = require('path'); +const BabiliPlugin = require('babili-webpack-plugin'); + +const production = process.env.NODE_ENV === 'production'; function isDir(file) { return fs.statSync(path.join('./examples/src/js/', file)).isDirectory(); @@ -34,7 +37,7 @@ module.exports = { module: { loaders: [ { - test: /\.ts(x?)$/, + test: /\.ts$/, exclude: /node_modules/, loader: 'babel-loader!ts-loader' }, @@ -48,7 +51,11 @@ module.exports = { 'env', { targets: { - browsers: ['last 2 versions', 'ios_saf >= 8', 'not IE <= 10'] + browsers: [ + 'last 2 versions', + 'ios_saf >= 10.2', + 'not IE <= 10' + ] } } ] @@ -58,5 +65,6 @@ module.exports = { } ] }, - stats: 'minimal' + stats: 'minimal', + plugins: production ? [new BabiliPlugin()] : [] };