feat: CSS modules

This commit is contained in:
cha0s 2022-03-12 08:29:26 -06:00
parent 6d26638cc8
commit b9018fdaa1
2 changed files with 19 additions and 14 deletions

View File

@ -38,12 +38,9 @@ module.exports = (async () => {
}]);
// Entrypoints.
const {output: originalOutput} = options;
options.root = root;
config.context(options.root);
options.source = '.';
options.mains.index = 'entry';
options.mains.index = join(root, 'entry');
options.mains.tests = {
entry: './client/tests',
entry: join(root, 'client', 'tests'),
title: 'Testbed',
};
options.output = join(originalOutput, flecks.get('@flecks/http/server.output'));
@ -84,7 +81,7 @@ module.exports = (async () => {
.publicPath('/')
.filename(isProduction ? 'assets/[name].[contenthash:8].js' : 'assets/[name].js');
config
.devtool(isProduction ? 'source-map' : 'eval-source-map')
.devtool('source-map')
.target('web');
config.node
.set('Buffer', true)

View File

@ -12,14 +12,22 @@ const debug = D('@flecks/http/server');
export default {
[Hooks]: {
'@flecks/core.build': (target, config) => {
config.use.push(styleLoader({
extract: {
enabled: false,
},
style: {
injectType: 'lazyStyleTag',
},
}));
config.use.push((neutrino) => {
const isProduction = 'production' === neutrino.config.get('mode');
neutrino.use(
styleLoader({
extract: {
enabled: false,
},
modules: {
localIdentName: isProduction ? '[hash]' : '[path][name]__[local]',
},
style: {
injectType: 'lazyStyleTag',
},
}),
);
});
config.use.push(fontLoader());
config.use.push(imageLoader());
},