92 lines
2.1 KiB
JavaScript
92 lines
2.1 KiB
JavaScript
const path = require('path');
|
|
|
|
const copy = require('@neutrinojs/copy');
|
|
const react = require('@neutrinojs/react');
|
|
const styles = require('@neutrinojs/style-loader');
|
|
const globImporter = require('node-sass-glob-importer');
|
|
const scwp = require('scwp/neutrino');
|
|
const {DefinePlugin} = require('webpack');
|
|
|
|
const {afterPlatform, initial} = require('./middleware');
|
|
|
|
module.exports = {
|
|
options: {
|
|
root: __dirname,
|
|
},
|
|
use: [
|
|
initial({
|
|
scwpPaths: [
|
|
/^@avocado/,
|
|
],
|
|
}),
|
|
react({
|
|
style: {
|
|
test: /\.(css|sass|scss)$/,
|
|
modulesTest: /\.module\.(css|sass|scss)$/,
|
|
loaders: [
|
|
{
|
|
loader: 'postcss-loader',
|
|
useId: 'postcss',
|
|
options: {
|
|
config: {
|
|
path: __dirname,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
loader: 'sass-loader',
|
|
useId: 'sass',
|
|
options: {
|
|
importer: globImporter(),
|
|
},
|
|
},
|
|
],
|
|
},
|
|
html: {
|
|
template: `${__dirname}/src/client/index.ejs`,
|
|
title: 'reddichat',
|
|
},
|
|
}),
|
|
afterPlatform({
|
|
babelPaths: [
|
|
/^@avocado/,
|
|
],
|
|
}),
|
|
(neutrino) => {
|
|
neutrino.config.module.rule('style')
|
|
.oneOf('raw')
|
|
.before('normal')
|
|
.test(/\.raw\.(css|sass|scss)$/)
|
|
.use('raw')
|
|
.loader('raw-loader')
|
|
.end()
|
|
.use('postcss')
|
|
.loader('postcss-loader')
|
|
.options({config: {path: __dirname}})
|
|
.end()
|
|
.use('sass')
|
|
.loader('sass-loader')
|
|
.options({importer: globImporter()})
|
|
.end()
|
|
neutrino.config.resolve.modules
|
|
.add(`${neutrino.options.source}/client/scss`);
|
|
neutrino.config
|
|
.plugin('avocado-define')
|
|
.use(DefinePlugin, [
|
|
{
|
|
AVOCADO_CLIENT: true,
|
|
AVOCADO_SERVER: false,
|
|
},
|
|
]);
|
|
},
|
|
copy({
|
|
patterns: [
|
|
{
|
|
from: 'src/common/favicon.ico',
|
|
to: 'favicon.ico',
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
};
|