Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/config/webpack.config.development.js
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | overlay: { | ||||
warnings: true, | warnings: true, | ||||
errors: true | errors: true | ||||
} | } | ||||
}, | }, | ||||
// set entries to the bundles we want to produce | // set entries to the bundles we want to produce | ||||
entry: bundles, | entry: bundles, | ||||
// assets output configuration | // assets output configuration | ||||
output: { | output: { | ||||
path: path.resolve('./swh/web/static/'), | path: path.resolve('./static/'), | ||||
filename: 'js/[name].[chunkhash].js', | filename: 'js/[name].[chunkhash].js', | ||||
chunkFilename: 'js/[name].[chunkhash].js', | chunkFilename: 'js/[name].[chunkhash].js', | ||||
publicPath: publicPath, | publicPath: publicPath, | ||||
// each bundle will be compiled as a umd module with its own namespace | // each bundle will be compiled as a umd module with its own namespace | ||||
// in order to easily use them in django templates | // in order to easily use them in django templates | ||||
library: ['swh', '[name]'], | library: ['swh', '[name]'], | ||||
libraryTarget: 'umd' | libraryTarget: 'umd' | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | plugins: [ | ||||
// cleanup previously generated assets | // cleanup previously generated assets | ||||
new CleanWebpackPlugin({ | new CleanWebpackPlugin({ | ||||
cleanOnceBeforeBuildPatterns: ['**/*', '!xml', '!xml/*', '!img', '!img/*', | cleanOnceBeforeBuildPatterns: ['**/*', '!xml', '!xml/*', '!img', '!img/*', | ||||
'!img/logos', '!img/logos/*', '!img/icons', | '!img/logos', '!img/logos/*', '!img/icons', | ||||
'!img/icons/*'] | '!img/icons/*'] | ||||
}), | }), | ||||
// needed in order to use django_webpack_loader | // needed in order to use django_webpack_loader | ||||
new BundleTracker({ | new BundleTracker({ | ||||
filename: './swh/web/static/webpack-stats.json' | filename: './static/webpack-stats.json' | ||||
}), | }), | ||||
// for generating the robots.txt file | // for generating the robots.txt file | ||||
new RobotstxtPlugin({ | new RobotstxtPlugin({ | ||||
policy: [{ | policy: [{ | ||||
userAgent: '*', | userAgent: '*', | ||||
disallow: '/api/' | disallow: '/api/' | ||||
}] | }] | ||||
}), | }), | ||||
Show All 22 Lines | new webpack.ProvidePlugin({ | ||||
Tab: 'exports-loader?Tab!bootstrap/js/dist/tab', | Tab: 'exports-loader?Tab!bootstrap/js/dist/tab', | ||||
Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip', | Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip', | ||||
Util: 'exports-loader?Util!bootstrap/js/dist/util' | Util: 'exports-loader?Util!bootstrap/js/dist/util' | ||||
}), | }), | ||||
// needed in order to use pdf.js | // needed in order to use pdf.js | ||||
new webpack.IgnorePlugin(/^\.\/pdf.worker.js$/), | new webpack.IgnorePlugin(/^\.\/pdf.worker.js$/), | ||||
new CopyWebpackPlugin([{ | new CopyWebpackPlugin([{ | ||||
from: path.resolve(nodeModules, 'pdfjs-dist/build/pdf.worker.min.js'), | from: path.resolve(nodeModules, 'pdfjs-dist/build/pdf.worker.min.js'), | ||||
to: path.resolve(__dirname, '../../static/js/') | to: path.resolve(__dirname, '../../../../static/js/') | ||||
}]), | }]), | ||||
new GenerateWebLabelsPlugin({ | new GenerateWebLabelsPlugin({ | ||||
outputType: 'json', | outputType: 'json', | ||||
exclude: ['mini-css-extract-plugin', | exclude: ['mini-css-extract-plugin', | ||||
'bootstrap-loader'], | 'bootstrap-loader'], | ||||
srcReplace: { | srcReplace: { | ||||
'./node_modules/pdfjs-dist/build/pdf.min.js': | './node_modules/pdfjs-dist/build/pdf.min.js': | ||||
'./node_modules/pdfjs-dist/build/pdf.js', | './node_modules/pdfjs-dist/build/pdf.js', | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |