Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fixing missing webpack loaders for images

Ilian Sapundshievfefe439937b1
diff --git a/webpack.config.worker.prod.js b/webpack.config.worker.prod.js
index 0d0ae0447..bbc48fb13 100644
--- a/webpack.config.worker.prod.js
+++ b/webpack.config.worker.prod.js
@@ -26,6 +26,102 @@ export default merge.smart(baseConfig, {
'pdfjs-dist': 'commonjs app/node_modules/@tagspaces/pro/libs/pdfjs-dist/build/pdf.min'
}, */
+ module: {
+ rules: [
+ // Extract all .global.css to style.css as is
+ {
+ test: /\.global\.css$/,
+ use: ExtractTextPlugin.extract({
+ use: 'css-loader',
+ fallback: 'style-loader',
+ })
+ },
+ // Pipe other styles through css modules and append to style.css
+ {
+ test: /^((?!\.global).)*\.css$/,
+ use: ExtractTextPlugin.extract({
+ use: {
+ loader: 'css-loader',
+ options: {
+ modules: true,
+ importLoaders: 1,
+ localIdentName: '[name]__[local]__[hash:base64:5]',
+ }
+ }
+ }),
+ },
+ // Add SASS support - compile all .global.scss files and pipe it to style.css
+ {
+ test: /\.global\.scss$/,
+ use: ExtractTextPlugin.extract({
+ use: [
+ {
+ loader: 'css-loader'
+ },
+ {
+ loader: 'sass-loader'
+ }
+ ],
+ fallback: 'style-loader',
+ })
+ },
+ // Add SASS support - compile all other .scss files and pipe it to style.css
+ {
+ test: /^((?!\.global).)*\.scss$/,
+ use: ExtractTextPlugin.extract({
+ use: [{
+ loader: 'css-loader',
+ options: {
+ modules: true,
+ importLoaders: 1,
+ localIdentName: '[name]__[local]__[hash:base64:5]',
+ }
+ },
+ {
+ loader: 'sass-loader'
+ }]
+ }),
+ },
+ // Add LESS support - compile all other .less files and pipe it to style.css
+ {
+ test: /\.less$/,
+ use: ExtractTextPlugin.extract({
+ use: [{
+ loader: 'css-loader'
+ }, {
+ loader: 'less-loader'
+ }],
+ // use style-loader in development
+ fallback: 'style-loader'
+ })
+ },
+ // Fonts
+ {
+ test: /\.(woff|woff2|eot|ttf)$/,
+ use: [{
+ loader: 'file-loader',
+ options: {
+ publicPath: '../dist/',
+ }
+ }]
+ },
+ // Common Image Formats
+ {
+ test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/,
+ use: {
+ loader: 'url-loader',
+ /* options: {
+ limit: 15000
+ } */
+ }
+ },
+ {
+ test: /\.(?:svg)$/,
+ use: 'url-loader',
+ }
+ ]
+ },
+
plugins: [
/**
* Create global constants which can be configured at compile time.