mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-03-15 15:30:49 +00:00
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
|
|
|
const webpack = require('webpack');
|
|
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
// const isProduction = process.env.NODE_ENV == 'production';
|
|
const isProduction = false;
|
|
|
|
const stylesHandler = 'style-loader';
|
|
|
|
const config = {
|
|
entry: './playground/index.ts',
|
|
output: {
|
|
path: path.resolve(__dirname, 'playground_dist'),
|
|
},
|
|
devServer: {
|
|
open: true,
|
|
host: 'localhost',
|
|
static: {
|
|
directory: path.join(__dirname, 'playground_public'),
|
|
},
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: 'playground/index.html',
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: 'process/browser',
|
|
}),
|
|
|
|
// Add your plugins here
|
|
// Learn more about plugins from https://webpack.js.org/configuration/plugins/
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(ts|tsx)$/i,
|
|
loader: 'ts-loader',
|
|
exclude: ['/node_modules/'],
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: [stylesHandler, 'css-loader'],
|
|
},
|
|
{
|
|
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
|
type: 'asset',
|
|
},
|
|
|
|
// Add your rules for custom modules here
|
|
// Learn more about loaders from https://webpack.js.org/loaders/
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.ts', '.js', 'css'],
|
|
},
|
|
};
|
|
|
|
module.exports = () => {
|
|
if (isProduction) {
|
|
config.mode = 'production';
|
|
} else {
|
|
config.mode = 'development';
|
|
}
|
|
return config;
|
|
};
|