Skip to content

Commit

Permalink
Updating webpack configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliemaia committed Sep 8, 2017
1 parent 61b6623 commit 19e4116
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
37 changes: 22 additions & 15 deletions 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()] : []
};
14 changes: 11 additions & 3 deletions 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();
Expand Down Expand Up @@ -34,7 +37,7 @@ module.exports = {
module: {
loaders: [
{
test: /\.ts(x?)$/,
test: /\.ts$/,
exclude: /node_modules/,
loader: 'babel-loader!ts-loader'
},
Expand All @@ -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'
]
}
}
]
Expand All @@ -58,5 +65,6 @@ module.exports = {
}
]
},
stats: 'minimal'
stats: 'minimal',
plugins: production ? [new BabiliPlugin()] : []
};

0 comments on commit 19e4116

Please sign in to comment.