UNPKG

1.76 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _path = require('path');
8
9var _path2 = _interopRequireDefault(_path);
10
11var _webpack = require('webpack');
12
13var _webpack2 = _interopRequireDefault(_webpack);
14
15var _utils = require('./utils');
16
17function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19var entries = {
20 preview: [],
21 manager: [_path2.default.resolve(__dirname, '../../manager')]
22};
23
24var config = {
25 bail: true,
26 devtool: '#cheap-module-source-map',
27 entry: entries,
28 output: {
29 filename: 'static/[name].bundle.js',
30 // Here we set the publicPath to ''.
31 // This allows us to deploy storybook into subpaths like GitHub pages.
32 // This works with css and image loaders too.
33 // This is working for storybook since, we don't use pushState urls and
34 // relative URLs works always.
35 publicPath: ''
36 },
37 plugins: [new _webpack2.default.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }), new _webpack2.default.optimize.DedupePlugin(), new _webpack2.default.optimize.UglifyJsPlugin({
38 compress: {
39 screw_ie8: true,
40 warnings: false
41 },
42 mangle: {
43 screw_ie8: true
44 },
45 output: {
46 comments: false,
47 screw_ie8: true
48 }
49 })],
50 module: {
51 loaders: [{
52 test: /\.jsx?$/,
53 loader: require.resolve('babel-loader'),
54 query: require('./babel.prod.js'),
55 include: _utils.includePaths,
56 exclude: _utils.excludePaths
57 }]
58 }
59};
60
61// Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode.
62// But webpack 1 has it. That's why we do this.
63if (_utils.OccurenceOrderPlugin) {
64 config.plugins.unshift(new _utils.OccurenceOrderPlugin());
65}
66
67exports.default = config;
\No newline at end of file