fix: use webpack for npm dependencies#163
Conversation
5277144 to
e944a43
Compare
|
@TheElixZammuto would you be able to give this a review? This is my first time using webpack and want to make sure I'm not doing anything wrong. Everything seems to work, but one thing I don't like it the new paths for the dependencies.
I would like I did find a way to accomplish that with the below code, but it seems pretty hacky. It also creates an empty const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
function generateEntry(entries) {
const entry = {};
entries.forEach(entryPoint => {
let key = entryPoint;
if (entryPoint.startsWith('script-loader!')) {
key = entryPoint.replace('script-loader!', '');
}
const dir = path.dirname(key);
const filename = path.basename(key, path.extname(key)); // filename without extension
key = path.join(dir, filename);
entry[key] = entryPoint;
});
return entry;
}
module.exports = {
entry: generateEntry([
'bootstrap/dist/js/bootstrap.bundle.min.js',
'bootstrap/dist/css/bootstrap.min.css',
'@fortawesome/fontawesome-free/css/all.min.css',
'jquery/dist/jquery.min.js',
'@popperjs/core/dist/umd/popper.min.js',
]),
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
mode: 'production',
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
};Anyway, I'd appreciate any pointers on this so I don't propagate any bad practices over to other repos. |
|
Any reason why you are not using Vite instead? It does not require Vue and it works as expected on Sunshine, I think you might cover 99% of the work you're trying to do with the work we've already done on Sunshine |
The only reason being that webpack came up first in search results. I know that vite is newer and gaining popularity though. |
e944a43 to
1bfd2a7
Compare
1bfd2a7 to
5cbf082
Compare
|
Closing in favor of #186 |
Description
./distto./srcTodo:
Screenshot
Issues Fixed or Closed
Type of Change
.github/...)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.