persea-old/.neutrinorc.client.js

99 lines
2.3 KiB
JavaScript
Raw Normal View History

2020-06-17 11:01:01 -05:00
const path = require('path');
2020-07-02 02:17:31 -05:00
const copy = require('@neutrinojs/copy');
2020-06-17 11:01:01 -05:00
const react = require('@neutrinojs/react');
const styles = require('@neutrinojs/style-loader');
const globImporter = require('node-sass-glob-importer');
2020-06-18 07:52:38 -05:00
const scwp = require('scwp/neutrino');
2020-06-17 11:01:01 -05:00
const {DefinePlugin} = require('webpack');
const {afterPlatform, initial} = require('./middleware');
module.exports = {
options: {
root: __dirname,
},
use: [
initial({
environmentDefines: ['FRONTEND_ORIGIN'],
2020-06-18 07:52:38 -05:00
rawScwpPaths: [
`${__dirname}/../humus/src/common`,
`${__dirname}/../humus/src/server`,
],
scwpPaths: [
/^@avocado/,
],
2020-06-17 11:01:01 -05:00
}),
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: 'Persea',
},
}),
afterPlatform({
2020-06-18 07:52:38 -05:00
babelPaths: [
/^@avocado/,
`${__dirname}/../humus/src/common`,
`${__dirname}/../humus/src/server`,
],
2020-06-17 11:01:01 -05:00
}),
(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,
},
]);
2020-07-02 02:17:31 -05:00
},
copy({
patterns: [
{
from: 'src/common/icon.png',
to: 'icon.png',
},
],
}),
2020-06-17 11:01:01 -05:00
],
};