1 | 'use strict';
|
2 |
|
3 | var _lodash = require('lodash');
|
4 |
|
5 | var _WebpackTask = require('./WebpackTask');
|
6 |
|
7 | var _WebpackTask2 = _interopRequireDefault(_WebpackTask);
|
8 |
|
9 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | Elixir.webpack = {
|
23 | config: {
|
24 | watch: Elixir.isWatching(),
|
25 | watchOptions: {
|
26 | poll: false,
|
27 | ignored: /node_modules/
|
28 | },
|
29 | devtool: Elixir.config.sourcemaps ? 'eval-cheap-module-source-map' : '',
|
30 | module: {
|
31 | loaders: [{ test: /\.jsx?$/, loader: 'buble', exclude: /node_modules/ }]
|
32 | },
|
33 | stats: {
|
34 | assets: false,
|
35 | version: false
|
36 | },
|
37 | resolve: {
|
38 | extensions: ['', '.js', '.jsx']
|
39 | }
|
40 | },
|
41 |
|
42 | mergeConfig: function mergeConfig(newConfig) {
|
43 | return this.config = (0, _lodash.mergeWith)(this.config, newConfig, function (objValue, srcValue) {
|
44 | if ((0, _lodash.isArray)(objValue)) {
|
45 | return objValue.concat(srcValue);
|
46 | }
|
47 | });
|
48 | }
|
49 | };
|
50 |
|
51 | Elixir.extend('webpack', function (scripts, output, baseDir, options) {
|
52 | new _WebpackTask2.default('webpack', getPaths(scripts, baseDir, output), options);
|
53 | });
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | function getPaths(src, baseDir, output) {
|
64 | return new Elixir.GulpPaths().src(src, baseDir || Elixir.config.get('assets.js.folder')).output(output || Elixir.config.get('public.js.outputFolder'), 'all.js');
|
65 | } |
\ | No newline at end of file |