2017-05-12 00:23:56 +00:00
|
|
|
/* eslint-disable */
|
2016-09-15 03:50:59 +00:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2020-07-18 18:02:40 +00:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2020-08-12 20:16:10 +00:00
|
|
|
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');
|
2020-08-15 00:23:58 +00:00
|
|
|
const pkg = require("rich-markdown-editor/package.json");
|
2016-02-27 21:53:11 +00:00
|
|
|
|
2017-02-10 05:55:36 +00:00
|
|
|
require('dotenv').config({ silent: true });
|
2016-02-27 21:53:11 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
output: {
|
2020-08-24 02:10:16 +00:00
|
|
|
path: path.join(__dirname, 'build/app'),
|
2020-08-18 05:09:12 +00:00
|
|
|
filename: '[name].[hash].js',
|
2016-09-15 03:50:59 +00:00
|
|
|
publicPath: '/static/',
|
2016-02-27 21:53:11 +00:00
|
|
|
},
|
|
|
|
module: {
|
2018-01-04 00:29:01 +00:00
|
|
|
rules: [
|
2016-02-27 21:53:11 +00:00
|
|
|
{
|
2020-08-18 05:09:12 +00:00
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: [
|
|
|
|
path.join(__dirname, 'node_modules')
|
|
|
|
],
|
|
|
|
include: [
|
|
|
|
path.join(__dirname, 'app'),
|
|
|
|
path.join(__dirname, 'shared'),
|
|
|
|
],
|
|
|
|
options: {
|
|
|
|
cacheDirectory: true
|
|
|
|
}
|
2016-02-27 21:53:11 +00:00
|
|
|
},
|
2016-09-15 03:50:59 +00:00
|
|
|
// inline base64 URLs for <=8k images, direct URLs for the rest
|
|
|
|
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' },
|
2016-05-04 06:43:43 +00:00
|
|
|
{
|
2020-08-18 05:09:12 +00:00
|
|
|
test: /\.woff$/,
|
|
|
|
loader: 'url-loader?limit=1&mimetype=application/font-woff&name=public/fonts/[name].[ext]',
|
2016-05-04 06:43:43 +00:00
|
|
|
},
|
2017-05-12 00:23:56 +00:00
|
|
|
{ test: /\.md/, loader: 'raw-loader' },
|
2018-11-10 07:40:33 +00:00
|
|
|
]
|
2016-02-27 21:53:11 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-01-04 00:29:01 +00:00
|
|
|
modules: [
|
2018-01-04 05:35:13 +00:00
|
|
|
path.resolve(__dirname, 'app'),
|
2018-01-04 00:29:01 +00:00
|
|
|
'node_modules'
|
|
|
|
],
|
2018-01-15 21:23:45 +00:00
|
|
|
mainFields: ["browser", "main"],
|
2018-01-04 00:29:01 +00:00
|
|
|
alias: {
|
2018-01-04 05:35:13 +00:00
|
|
|
shared: path.resolve(__dirname, 'shared'),
|
2018-01-04 00:29:01 +00:00
|
|
|
}
|
2016-02-27 21:53:11 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2020-08-15 00:23:58 +00:00
|
|
|
new webpack.DefinePlugin({
|
2021-02-13 00:53:16 +00:00
|
|
|
"process.env.SOURCE_COMMIT": JSON.stringify(process.env.SOURCE_COMMIT),
|
|
|
|
"process.env.SOURCE_VERSION": JSON.stringify(process.env.SOURCE_VERSION),
|
|
|
|
"EDITOR_VERSION": JSON.stringify(pkg.version)
|
2020-08-15 00:23:58 +00:00
|
|
|
}),
|
2016-02-27 21:53:11 +00:00
|
|
|
new webpack.ProvidePlugin({
|
2018-01-04 00:29:01 +00:00
|
|
|
fetch: 'imports-loader?this=>global!exports-loader?global.fetch!isomorphic-fetch',
|
2016-02-27 21:53:11 +00:00
|
|
|
}),
|
2017-07-11 04:47:02 +00:00
|
|
|
new webpack.IgnorePlugin(/unicode\/category\/So/),
|
2020-07-18 18:02:40 +00:00
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: 'server/static/index.html',
|
|
|
|
}),
|
2020-08-12 20:16:10 +00:00
|
|
|
new RelativeCiAgentWebpackPlugin(),
|
2016-06-05 01:28:14 +00:00
|
|
|
],
|
2016-08-27 20:18:46 +00:00
|
|
|
stats: {
|
|
|
|
assets: false,
|
|
|
|
},
|
2020-08-18 05:09:12 +00:00
|
|
|
optimization: {
|
|
|
|
runtimeChunk: 'single',
|
|
|
|
moduleIds: 'hashed',
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
vendor: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
name: 'vendors',
|
|
|
|
chunks: 'initial',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2016-07-24 22:32:31 +00:00
|
|
|
};
|