|
1 | | -/* START SOLUTION */ |
2 | 1 | /* |
3 | 2 | * This is where we tell Webpack exactly what we want it to do. |
4 | 3 | * |
|
8 | 7 | * 3) What we want to do with the files in our app (module.loaders) |
9 | 8 | */ |
10 | 9 |
|
11 | | -module.exports = { |
12 | | - /* |
13 | | - * Organizing our code in modules is a bit different than the traditional style. |
14 | | - * Gone are the days of endless <script> tags in index.html that must be carefully ordered. |
15 | | - * Instead, our `entry` point defines where our app starts. It's here where we'll import |
16 | | - * all other files as needed, and Webpack manages the tree of dependencies automagically. |
17 | | - * |
18 | | - * If you've ever used node, your app's entry point is conventionally `index.js` |
19 | | - */ |
20 | | - // entry: './client/app.js', (unnecessary with gulp - gulp.src does this for us) |
21 | | - |
22 | | - /* |
23 | | - * Not only will Webpack gracefully manage the tree of dependencies for us, it can also |
24 | | - * smash all the dependencies into one convenient file that we can send over the wire. |
25 | | - * This is similar to minification. The `output` object defines where this minified file should live |
26 | | - */ |
27 | | - output: { |
28 | | - // path: __dirname + '/client', // Absolute (!) path for our output file (unnecessary with gulp - gulp.dest does this for us) |
29 | | - filename: 'bundle.js', // `bundle.js` is a typical convention for Webpack |
30 | | - }, |
31 | | - |
32 | | - /* |
33 | | - * Bundles are all fun and games until you have to debug them. It's not easy |
34 | | - * sorting through one giant file of transpiled ES5 code to see where you went wrong. |
35 | | - * |
36 | | - * Sourcemaps are an invaluable tool when debugging. They map your bundle to your |
37 | | - * source files and allow you to trace errors in your bundle back to the code you |
38 | | - * actually wrote. You should always use source maps when developing with a transpiler. |
39 | | - */ |
40 | | - devtool: 'sourcemap', // Will be created at './client/app/bundle.js.map' |
41 | | - |
42 | | - /* |
43 | | - * This is where most of magic happens. Webpack loaders allow you to preprocess files as you import them. |
44 | | - * They are kind of like 'tasks' in other build tools. In fact, if you are using another build tool |
45 | | - * like gulp or grunt along with Webpack, you should leave any task that touch files |
46 | | - * (transpilation, minification, etc) to Webpack and use your other build system to orchastrate other automation. |
47 | | - * |
48 | | - * Loaders can tranform files from a different language (TypeScript to JavaScript or ES6 to ES5!) |
49 | | - * Loaders even allow you to do things like import css files right in your JavaScript! |
50 | | -
|
51 | | - * Each loader is just an object that defines (1) a collection of files (2) the transformation. |
52 | | - * Here's how the properties work: |
53 | | - * test: A condition that must be met (regex) |
54 | | - * loader: A string of "!" separated loaders (these are executed from right to left) |
55 | | - * include: A condition that must be met (not included, but reges) |
56 | | - * exclude: A condition that must not be met (regex) |
57 | | - */ |
58 | | - module: { |
59 | | - loaders: [ |
60 | | - { test: /\.js$/, loader: 'babel', exclude: [/node_modules/]}, // Transpile our .js from ES6 to ES5 |
61 | | - { test: /\.html$/, loader: 'raw' }, // 'raw' will import our html as a string - great for Angular templates! |
62 | | - { test: /\.css$/, loader: 'style!css' } // 'css' loader will parse our stylesheets, and 'style' loader will inject it into the <head> of our index.html |
63 | | - ] |
64 | | - } |
65 | | -}; |
66 | | -/* END SOLUTION */ |
| 10 | +module.exports = {}; |
0 commit comments