1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00
awx/webpack.config.js
John Mitchell fed7f51476
update build system
polyfill new js features before executing tests
move jest config to file, update transformation exclusion to be okay with axios module
rename enzyme.config.js to jest.setup.js
remove currently unused redux deps
update babel to 7, use env preset as opposed to deprecated stage preset
move .babelrc to newer, favored babel.config.js preset
update all babel preset and plugin packages to those name spaced under @babel
2018-10-30 17:25:29 -04:00

102 lines
2.3 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const TARGET_PORT = 8043;
const TARGET = `https://localhost:${TARGET_PORT}`;
module.exports = {
entry: './src/index.jsx',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.s?[ac]ss$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
]
},
{
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'assets/fonts/',
publicPatH: '../',
includePaths: [
'node_modules/@patternfly/patternfly-next/assets/fonts',
]
}
}]
},
{
test: /\.(jpg|png|gif|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'assets/images/',
publicPatH: '../',
includePaths: [
'node_modules/@patternfly/patternfly-next/assets/images',
]
}
}]
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx', '.css']
},
output: {
path: path.resolve(__dirname, '/dist'),
publicPath: '/',
filename: 'bundle.js'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
devServer: {
contentBase: './dist',
hot: true,
inline: true,
stats: 'minimal',
host: '127.0.0.1',
https: true,
port: 3001,
clientLogLevel: 'none',
proxy: [
{
context: '/api/login/',
target: TARGET,
secure: false,
ws: false,
headers: {
Host: `localhost:${TARGET_PORT}`,
Origin: TARGET,
Referer: `${TARGET}/`
}
},
{
context: '/api',
target: TARGET,
secure: false,
ws: false,
bypass: req => (req.originalUrl.includes('hot-update.json') || req.originalUrl.includes('login')),
},
{
context: '/websocket',
target: TARGET,
secure: false,
ws: true
}
]
}
};