]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - webpack.config.js
1 const path
= require('path');
2 const glob
= require('glob');
5 const TerserPlugin
= require('terser-webpack-plugin');
7 // This plugin extracts the CSS into its own file instead of tying it with the JS.
9 // - not having styles due to a JS error
10 // - the flash page without styles during JS loading
11 const MiniCssExtractPlugin
= require("mini-css-extract-plugin");
13 const extractCss
= new MiniCssExtractPlugin({
14 filename: "../css/[name].min.css",
21 shaare_batch: './assets/common/js/shaare-batch.js',
22 thumbnails: './assets/common/js/thumbnails.js',
23 thumbnails_update: './assets/common/js/thumbnails-update.js',
24 metadata: './assets/common/js/metadata.js',
25 pluginsadmin: './assets/default/js/plugins-admin.js',
27 './assets/default/js/base.js',
28 './assets/default/scss/shaarli.scss',
29 ].concat(glob
.sync('./assets/default/img/*')),
30 markdown: './assets/common/css/markdown.css',
33 filename: '[name].min.js',
34 path: path
.resolve(__dirname
, 'tpl/default/js/')
40 exclude: /node_modules/,
42 loader: 'babel-loader',
54 loader: MiniCssExtractPlugin
.loader
,
56 publicPath: 'tpl/default/css/',
64 test: /\.(gif|png|jpe?g|svg|ico)$/i,
67 loader: 'file-loader',
69 name: '../img/[name].[ext]',
70 publicPath: 'tpl/default/img/',
76 test: /\.(eot|ttf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
77 loader: 'file-loader',
79 name: '../fonts/[name].[ext]',
80 // do not add a publicPath here because it's already handled by CSS's publicPath
81 publicPath: '../default/',
88 minimizer: [new TerserPlugin()],
98 './assets/vintage/js/base.js',
99 './assets/vintage/css/reset.css',
100 './assets/vintage/css/shaarli.css',
101 ].concat(glob
.sync('./assets/vintage/img/*')),
102 markdown: './assets/common/css/markdown.css',
103 thumbnails: './assets/common/js/thumbnails.js',
104 metadata: './assets/common/js/metadata.js',
105 thumbnails_update: './assets/common/js/thumbnails-update.js',
108 filename: '[name].min.js',
109 path: path
.resolve(__dirname
, 'tpl/vintage/js/')
115 exclude: /node_modules/,
117 loader: 'babel-loader',
129 loader: MiniCssExtractPlugin
.loader
,
131 publicPath: 'tpl/vintage/css/',
139 test: /\.(gif|png|jpe?g|svg|ico)$/i,
142 loader: 'file-loader',
144 name: '../img/[name].[ext]',
154 minimizer: [new TerserPlugin()],