generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
razzle.extend.js
40 lines (32 loc) · 1.02 KB
/
razzle.extend.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const path = require('path');
const makeLoaderFinder = require('razzle-dev-utils/makeLoaderFinder');
const modify = (config, { target, dev }, webpack) => {
const markedPath = path.dirname(require.resolve('marked'));
const nodeFetch = path.dirname(require.resolve('node-fetch'));
const babelLoaderFinder = makeLoaderFinder('babel-loader');
const babelLoader = config.module.rules.find(babelLoaderFinder);
// config.module.rules.push({
// test: /node_modules\/vfile\//, // \/lib\/index\.js
// use: [
// {
// loader: 'imports-loader',
// options: {
// type: 'commonjs',
// // imports: ['single process/browser process'],
// },
// },
// ],
// });
const { include } = babelLoader;
include.push(markedPath);
// include.push(nodeFetch);
babelLoader.use[0].options.plugins = [
...(babelLoader.use[0].options.plugins || []),
'@babel/plugin-proposal-private-methods',
];
return config;
};
module.exports = {
plugins: (plugs) => plugs,
modify,
};