1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-24 08:22:29 +02:00
focalboard/webapp/webpack.common.js
Hossein 7fae65ea02
Start Welcome Page (#1231)
* start welcome page

* setup template

* setup forwarding logic

* fix linting errors

* Updating UI

* Use intl strings

* Address comments

* go to baords welcome

* Fix image problem

* fix linting

* fix getting shown wrong things

* fix build issues

* fix cypress test and non plugin

* Fix bugs

* remove console

* Add welcome page

* address comments

Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com>
2021-09-28 09:51:32 -04:00

124 lines
3.9 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
const tsTransformer = require('@formatjs/ts-transformer');
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const outpath = path.resolve(__dirname, 'pack');
function makeCommonConfig() {
const commonConfig = {
target: 'web',
mode: 'development',
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
getCustomTransformers: {
before: [
tsTransformer.transform({
overrideIdFn: '[sha512:contenthash:base64:6]',
ast: true,
}),
],
},
},
},
exclude: [/node_modules/],
},
{
test: /\.(png|jpg|jpeg|gif|html)$/,
type: 'asset/resource',
},
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{
test: /\.css$/i,
use: [
'style-loader',
'css-loader',
],
},
{
test: /\.(tsx?|js|jsx|mjs|html)$/,
use: [
],
exclude: [/node_modules/],
},
{
test: /\.(eot|tiff|svg|woff2|woff|ttf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'static',
},
},
{
loader: 'image-webpack-loader',
options: {},
},
],
},
],
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname),
],
fullySpecified: false,
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new CopyPlugin({
patterns: [
{from: path.resolve(__dirname, 'static'), to: 'static'},
{from: path.resolve(__dirname, 'node_modules/easymde/dist/easymde.min.css'), to: 'static'},
],
}),
new HtmlWebpackPlugin({
inject: true,
title: 'Focalboard',
chunks: ['main'],
template: 'html-templates/page.ejs',
filename: 'index.html',
publicPath: '{{.BaseURL}}/',
hash: true,
}),
],
entry: ['./src/main.tsx', './src/userSettings.ts'],
output: {
library: 'Focalboard',
filename: 'static/[name].js',
path: outpath,
},
};
return commonConfig;
}
module.exports = makeCommonConfig;