-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
37 lines (35 loc) · 1.37 KB
/
webpack.config.js
File metadata and controls
37 lines (35 loc) · 1.37 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
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require("webpack");
var nodeEnvironment = process.env.NODE_ENV
var config = {
context: __dirname,
entry: {
'vendor' : "./src/ts/vendor.ts",
'app' : './src/ts/index.ts' ,
'polyfills' : './src/ts/polyfills.ts'
},
resolve: {
extensions: ['', '.js', '.ts', '.tpl.html', '.css', '.less'],
modulesDirectories: [".", "components", "node_modules"]
},
output : {
path : __dirname,
filename: '/assets/[name].bundle.js',
},
module: {
loaders: [
{ test: /\.tpl.html/, loader: 'html'},
{ test: /\.ts$/, loader: 'ts-loader' },
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
// Extract css files
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
// Optionally extract less files
// or any other compile-to-css language
{ test: /\.less$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") },
{ test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.eot$|\.woff$|\.woff2$|\.ttf$|\.wav$|\.mp3$/, loader: require.resolve("file-loader") + "?name=/assets/[name].[ext]"}
]
},
// Use the plugin to specify the resulting filename (and add needed behavior to the compiler)
plugins: [ new ExtractTextPlugin("assets/style.css", {allChunks: true}) ]
};
module.exports = config;