hexa-viewer-communicator
Version:
A simple API for <hexa-viewer>
76 lines (68 loc) • 1.97 kB
JavaScript
const path = require('path');
const webpack = require('webpack');
const ROOT = path.resolve(__dirname, 'src');
const DESTINATION = path.resolve(__dirname, 'dist');
module.exports = {
mode: 'production',
context: ROOT,
entry: {
'main': './main.ts',
'viewer-communicator': './viewer-communicator.ts'
},
output: {
filename: '[name].bundle.js',
path: DESTINATION,
// This part makes the build.all stript expose all of our code to the user
// More info here:
// https://dev.to/_hridaysharma/setting-up-webpack-for-a-javascript-library-2h8m
// https://webpack.js.org/configuration/output/#outputlibrarytype
libraryTarget: 'umd'
},
resolve: {
extensions: ['.ts', '.js'],
modules: [
ROOT,
'node_modules'
]
},
module: {
rules: [
/****************
* PRE-LOADERS
*****************/
{
enforce: 'pre',
test: /\.js$/,
use: 'source-map-loader'
},
{
enforce: 'pre',
test: /\.ts$/,
exclude: /node_modules/,
use: 'tslint-loader'
},
/****************
* LOADERS
*****************/
{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}
]
},
devtool: 'cheap-module-source-map',
devServer: {
historyApiFallback: true,
static: path.resolve(__dirname, './src'),
hot: true,
port: 9002,
headers: {
"Access-Control-Allow-Origin": "*"
},
client: {
overlay: false,
webSocketURL: 'ws://127.0.0.1:9002/ws'
}
}
};