-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
47 lines (39 loc) · 1.54 KB
/
webpack.config.js
File metadata and controls
47 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const cssModules = 'modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]';
module.exports = {
// extensiones de los ficheros que queremos que vigile webpack
resolve: {
// https://github.com/webpack/webpack/issues/3043
extensions: ['*', '.js', '.jsx']
},
// punto de entrada de la aplicación
entry: ['./src/index.jsx'],
// fichero final (main en el package.json)
output: {
filename: 'app.js',
// https://github.com/aspnet/JavaScriptServices/issues/782
// http://stackoverflow.com/questions/42940050/configuration-output-path-the-provided-value-public-is-not-an-absolute-path
path: __dirname + '/build',
publicPath: '/'
},
module: {
loaders: [
// transpilador
// qué tipos de ficheros debe atender: con las extensiones js ó jsx, que no estén en node_modules, y debe
// hacerse mediante el cargador babel
{test: /(\.js|jsx)$/, exclude: /node_modules/, loaders: ['babel-loader'] },
{test: /\.css$/, loader: `style-loader!css-loader?${cssModules}` }
]
},
devServer: {
host: '0.0.0.0',
port: 8080,
inline: true
},
plugins: [
new HtmlWebpackPlugin({ template: './src/assets/index.html' }),
new ExtractTextPlugin({filename: 'style.css', allChunks: true})
]
}