Changeset View
Changeset View
Standalone View
Standalone View
assets/config/webpack.config.development.js
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | output: { | ||||
libraryTarget: 'umd' | libraryTarget: 'umd' | ||||
}, | }, | ||||
// module resolving configuration | // module resolving configuration | ||||
resolve: { | resolve: { | ||||
// alias pdfjs to its minified version | // alias pdfjs to its minified version | ||||
alias: { | alias: { | ||||
'pdfjs-dist': 'pdfjs-dist/build/pdf.min.js' | 'pdfjs-dist': 'pdfjs-dist/build/pdf.min.js' | ||||
}, | }, | ||||
// for web-tree-sitter | |||||
fallback: { | |||||
'path': false, | |||||
'fs': false | |||||
}, | |||||
// configure base paths for resolving modules with webpack | // configure base paths for resolving modules with webpack | ||||
modules: [ | modules: [ | ||||
'node_modules', | 'node_modules', | ||||
path.resolve(__dirname, '../src') | path.resolve(__dirname, '../src'), | ||||
path.resolve(__dirname, '../../../swh-search/query_language/') | |||||
] | ] | ||||
}, | }, | ||||
stats: 'errors-warnings', | stats: 'errors-warnings', | ||||
snapshot: { | snapshot: { | ||||
// fix webpack warning related to missing package.json file | // fix webpack warning related to missing package.json file | ||||
managedPaths: [/^highlightjs-/] | managedPaths: [/^highlightjs-/] | ||||
}, | }, | ||||
// module import configuration | // module import configuration | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | rules: [ | ||||
options: { | options: { | ||||
htmlmin: true, | htmlmin: true, | ||||
htmlminOptions: { | htmlminOptions: { | ||||
removeComments: true | removeComments: true | ||||
} | } | ||||
} | } | ||||
}] | }] | ||||
}, | }, | ||||
{ | |||||
test: /\.wasm$/, | |||||
type: 'javascript/auto', | |||||
use: [{ | |||||
loader: 'file-loader', | |||||
options: { | |||||
name: '[name].[ext]', | |||||
outputPath: 'js/' | |||||
} | |||||
}] | |||||
}, | |||||
// expose jquery to the global context as $ and jQuery when importing it | // expose jquery to the global context as $ and jQuery when importing it | ||||
{ | { | ||||
test: require.resolve('jquery'), | test: require.resolve('jquery'), | ||||
use: [{ | use: [{ | ||||
loader: 'expose-loader', | loader: 'expose-loader', | ||||
options: { | options: { | ||||
exposes: [ | exposes: [ | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | new CopyWebpackPlugin({ | ||||
patterns: [ | patterns: [ | ||||
{ | { | ||||
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/') | ||||
}, | }, | ||||
{ | { | ||||
from: path.resolve(nodeModules, 'mathjax/es5/output/chtml/fonts/woff-v2/**'), | from: path.resolve(nodeModules, 'mathjax/es5/output/chtml/fonts/woff-v2/**'), | ||||
to: path.resolve(__dirname, '../../static/fonts/[name][ext]') | to: path.resolve(__dirname, '../../static/fonts/[name][ext]') | ||||
}, | |||||
{ | |||||
from: path.resolve(__dirname, '../../tree-sitter-swh_search_ql.wasm'), | |||||
to: path.resolve(__dirname, '../../static/js/swh_ql.wasm') | |||||
}, | |||||
{ | |||||
from: path.resolve(__dirname, '../tokens.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: { | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |