3bf9d9382e
* Added implementation for making links clickable * Improved some clicking UX * Removed unused stuff * Fixed lint issues * Added Compass Icons to Focalboard * Updaed go.mod * Made sure links in URL property are always assumed as absolute * Removed unnecessary JSX code block * Allowing only http and https protocols * Removed unused extensions from file loader * Icon and URL imporvements * Added React component for Compass Icons. * Allowed URLs with any arbitrary protocol.
122 lines
3.8 KiB
JavaScript
122 lines
3.8 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: /\.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: /\.(png|eot|tiff|svg|woff2|woff|ttf|jpg)$/,
|
|
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}}/',
|
|
}),
|
|
],
|
|
entry: ['./src/main.tsx', './src/userSettings.ts'],
|
|
output: {
|
|
library: 'Focalboard',
|
|
filename: 'static/[name].js',
|
|
path: outpath,
|
|
},
|
|
};
|
|
|
|
return commonConfig;
|
|
}
|
|
|
|
module.exports = makeCommonConfig;
|