This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/config/webpack.base.js
2018-01-03 16:58:34 -08:00

81 lines
2.4 KiB
JavaScript

/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
require('dotenv').config({ silent: true });
const definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.NODE_ENV !== 'production')),
__PRERELEASE__: JSON.stringify(
JSON.parse(process.env.BUILD_PRERELEASE || 'false')
),
SLACK_APP_ID: JSON.stringify(process.env.SLACK_APP_ID),
BASE_URL: JSON.stringify(process.env.URL),
BUGSNAG_KEY: JSON.stringify(process.env.BUGSNAG_KEY),
DEPLOYMENT: JSON.stringify(process.env.DEPLOYMENT || 'hosted'),
'process.env': {
URL: JSON.stringify(process.env.URL),
SLACK_KEY: JSON.stringify(process.env.SLACK_KEY),
}
});
module.exports = {
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/',
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
include: [
path.join(__dirname, '../app'),
path.join(__dirname, '../shared'),
],
},
{ test: /\.json$/, loader: 'json-loader' },
// inline base64 URLs for <=8k images, direct URLs for the rest
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' },
{
test: /\.woff$/,
loader: 'url-loader?limit=1&mimetype=application/font-woff&name=public/fonts/[name].[ext]',
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
}),
},
{ test: /\.md/, loader: 'raw-loader' },
],
// Silence warning https://github.com/localForage/localForage/issues/599
noParse: [new RegExp('node_modules/localforage/dist/localforage.js')],
},
resolve: {
modules: [
path.resolve(__dirname, '../app'),
'node_modules'
],
alias: {
shared: path.resolve(__dirname, '../shared'),
'boundless-utils-omit-keys': 'boundless-utils-omit-keys/build',
'boundless-utils-uuid': 'boundless-utils-uuid/build'
}
},
plugins: [
definePlugin,
new webpack.ProvidePlugin({
fetch: 'imports-loader?this=>global!exports-loader?global.fetch!isomorphic-fetch',
}),
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/),
new webpack.IgnorePlugin(/unicode\/category\/So/),
],
stats: {
assets: false,
},
};