2017-05-22 22:49:20 +02:00
|
|
|
var path = require('path');
|
2017-05-25 19:37:07 +02:00
|
|
|
var assets = require('./webpack.assets.json');
|
2017-05-22 22:49:20 +02:00
|
|
|
|
2017-05-24 00:03:53 +02:00
|
|
|
module.exports = {
|
|
|
|
context: path.resolve(__dirname, "../"),
|
2017-05-25 19:37:07 +02:00
|
|
|
entry: assets,
|
2017-05-25 04:08:30 +02:00
|
|
|
module: {
|
2017-05-24 20:31:00 +02:00
|
|
|
rules: [
|
|
|
|
// Run the typescript compilier on .ts files before webpack
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
loader: 'ts-loader',
|
|
|
|
},
|
|
|
|
// This loads and transforms sourcemap files from other compiliers.
|
|
|
|
// The typescript comilier will generate a sourcemap and source-map-loaded will output
|
|
|
|
// the correct sourcemap from that.
|
|
|
|
{
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: "source-map-loader",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: "source-map-loader",
|
|
|
|
},
|
2017-05-25 00:18:27 +02:00
|
|
|
// Uses script-loader on minified files so we don't change global variables in them.
|
|
|
|
// Also has the effect of making processing these files fast
|
|
|
|
{
|
2017-05-25 01:32:27 +02:00
|
|
|
test: /(min|zxcvbn)\.js/,
|
2017-05-25 00:18:27 +02:00
|
|
|
use: [ 'script-loader' ],
|
|
|
|
},
|
2017-05-25 01:44:58 +02:00
|
|
|
// Expose Global variables to webpack
|
|
|
|
{
|
|
|
|
test: require.resolve('../static/js/debug.js'),
|
|
|
|
use: [
|
|
|
|
{loader: 'expose-loader', options: 'debug'},
|
|
|
|
],
|
|
|
|
},
|
2017-06-22 22:44:16 +02:00
|
|
|
{
|
|
|
|
test: require.resolve('../static/js/blueslip.js'),
|
|
|
|
use: [
|
|
|
|
{loader: 'expose-loader', options: 'blueslip'},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: require.resolve('../static/js/common.js'),
|
|
|
|
use: [
|
|
|
|
{loader: 'expose-loader', options: 'common'},
|
|
|
|
],
|
|
|
|
},
|
2017-05-24 20:31:00 +02:00
|
|
|
],
|
2017-05-25 00:18:27 +02:00
|
|
|
},
|
2015-10-26 17:11:44 +01:00
|
|
|
output: {
|
2017-05-24 00:03:53 +02:00
|
|
|
path: path.resolve(__dirname, '../static/webpack-bundles'),
|
|
|
|
filename: '[name].js',
|
2015-10-26 17:11:44 +01:00
|
|
|
},
|
2017-05-24 00:03:53 +02:00
|
|
|
plugins: [],
|
2017-05-24 20:31:00 +02:00
|
|
|
resolve: {
|
|
|
|
extensions: [".tsx", ".ts", ".js", ".json"],
|
|
|
|
},
|
2015-10-26 17:11:44 +01:00
|
|
|
};
|