1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-24 08:22:29 +02:00
focalboard/webapp/webpack.common.js

80 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-10-13 23:38:20 +02:00
const webpack = require("webpack")
const path = require("path")
const CopyPlugin = require("copy-webpack-plugin")
var HtmlWebpackPlugin = require('html-webpack-plugin')
2020-10-08 18:21:27 +02:00
2020-10-13 23:38:20 +02:00
const outpath = path.resolve(__dirname, "pack")
2020-10-08 18:21:27 +02:00
function makeCommonConfig() {
const commonConfig = {
target: "web",
mode: "development",
entry: "./index.js",
2020-10-08 18:21:27 +02:00
node: {
__dirname: false,
__filename: false
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: [/node_modules/],
},
{
test: /\.html$/,
loader: "file-loader",
},
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{
2020-10-08 18:21:27 +02:00
test: /\.(tsx?|js|jsx|html)$/,
use: [
],
exclude: [/node_modules/],
}
]
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname),
],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new CopyPlugin({
patterns: [
{ from: path.resolve(__dirname, "static"), to: "static" },
2020-10-08 18:21:27 +02:00
{ from: path.resolve(__dirname, "node_modules/easymde/dist/easymde.min.css"), to: "static" },
],
}),
new HtmlWebpackPlugin({
inject: true,
title: "OCTO",
chunks: ["main"],
2020-10-14 15:25:39 +02:00
template: "html-templates/page.ejs",
filename: 'index.html',
publicPath: '/'
2020-10-08 18:21:27 +02:00
}),
],
entry: {
main: "./src/main.tsx",
2020-10-08 18:21:27 +02:00
},
output: {
filename: "static/[name].js",
2020-10-08 18:21:27 +02:00
path: outpath
}
2020-10-13 23:38:20 +02:00
}
2020-10-08 18:21:27 +02:00
2020-10-13 23:38:20 +02:00
return commonConfig
2020-10-08 18:21:27 +02:00
}
2020-10-13 23:38:20 +02:00
module.exports = makeCommonConfig