Commit fb9073ee authored by Oleksii Savran's avatar Oleksii Savran Committed by Matija Obreza
Browse files

Map: CSS bundling

-fixed eslint warnings
parent 653a7317
......@@ -5,7 +5,7 @@ const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
// const CopyWebpackPlugin = require('copy-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// const fs = require('fs');
// devserver configuration
......@@ -15,7 +15,7 @@ const PORT = process.env.PORT || 3000;
module.exports = {
stats: {
colors: true
colors: true,
},
devServer: {
......@@ -26,27 +26,27 @@ module.exports = {
port: PORT,
host: HOST,
watchOptions: {
ignored: /node_modules/
ignored: /node_modules/,
},
overlay: {
warnings: true,
errors: true
errors: true,
},
clientLogLevel: 'warning',
historyApiFallback: {
disableDotRule: true
disableDotRule: true,
},
},
entry: {
genesys: [ 'babel-polyfill', /* './entrypoints/vendor.ts', */ './entrypoints/client.tsx' ]
genesys: ['babel-polyfill', /* './entrypoints/vendor.ts', */ './entrypoints/client.tsx'],
},
output: {
filename: '[name].[hash].js',
// chunkFilename: '[name].[hash].js',
path: path.join(process.cwd(), 'target/app/assets'),
publicPath: ''
publicPath: '',
},
resolve: {
......@@ -72,76 +72,56 @@ module.exports = {
loader: 'awesome-typescript-loader',
},
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: false
},
},
'resolve-url-loader', {
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: ['node_modules']
}
}
}
]
},
{
test: /\.css$/,
exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
// {
// test: /\.scss$/,
// use: [
// MiniCssExtractPlugin.loader,
// {
// loader: 'css-loader',
// options: {
// modules: false,
// },
// },
// 'resolve-url-loader', {
// loader: 'sass-loader',
// options: {
// sourceMap: true,
// sassOptions: {
// includePaths: ['node_modules'],
// },
// },
// },
// ],
// },
{
test: /\.css$/,
include: /node_modules\/react\-toolbox/,
// exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
sourceMap: true,
localIdentName: '[path][name]__[local]'
}
}, 'resolve-url-loader', 'postcss-loader'
]
'css-loader',
],
},
// fonts
{
test: /\.(woff|woff2|eot)(\?.*)?$/,
loader: 'file-loader?name=fonts/[hash].[ext]'
loader: 'file-loader?name=fonts/[hash].[ext]',
},
{
test: /\.ttf(\?.*)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&name=fonts/[hash].[ext]'
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&name=fonts/[hash].[ext]',
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
exclude: /node_modules\/leaflet/,
loader: 'url-loader?limit=100000&name=images/[name].[ext]'
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
include: /node_modules\/leaflet/,
loader: 'file-loader?limit=100000&name=images/[name].[ext]'
}
]
],
},
plugins: [
new ManifestPlugin({
basePath: '/html/'
basePath: '/html/',
}),
// Inject scripts to app's real index.html
......@@ -165,15 +145,18 @@ module.exports = {
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css'
chunkFilename: '[name].[hash].css',
}),
new HtmlWebpackExcludeAssetsPlugin(),
new CopyWebpackPlugin({
patterns: [
{ from: './node_modules/leaflet/dist/images', to: 'images' },
// Used with i18next-http-backend plugin
// new CopyWebpackPlugin([
// { from: 'src/locales', to: 'locales'},
// ]),
// { from: 'src/locales', to: 'locales' },
],
}),
],
// optimization: {
......
......@@ -19,9 +19,9 @@ module.exports = webpackMerge.smart(commonConfig, {
debug: true,
options: {
tslint: {
failOnHint: false
}
}
failOnHint: false,
},
},
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
......
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
......@@ -51,6 +52,20 @@ module.exports = {
loader: 'awesome-typescript-loader',
},
},
{
test: /\.css$/,
// exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
{
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
],
},
{
test: /\.scss$/,
use: [
......@@ -75,6 +90,22 @@ module.exports = {
],
},
plugins: [
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css',
}),
new CopyWebpackPlugin({
patterns: [
{ from: './node_modules/leaflet/dist/images', to: 'images' },
// Used with i18next-http-backend plugin
// { from: 'src/locales', to: 'locales' },
],
}),
],
optimization: {
noEmitOnErrors: true,
splitChunks: {
......
......@@ -9,9 +9,9 @@
<meta name="author" content="Genesys Team, helpdesk@genesys-pgr.org" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
<!-- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
crossorigin=""/> -->
</head>
<body>
......
......@@ -15,6 +15,8 @@ import OverviewPage from 'accession/OverviewPage';
import RequestPage from 'request/RequestPage';
import MapPage from 'map/MapPage';
import 'leaflet/dist/leaflet.css';
const hashHistory = createHashHistory({});
interface IAppProps extends React.ClassAttributes<any> {
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment