This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.neutrinorc.js
78 lines (69 loc) · 1.91 KB
/
.neutrinorc.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const standard = require('@neutrinojs/standardjs');
const path = require('path');
// const node = require('@neutrinojs/node');
const jest = require('@neutrinojs/jest');
const react = require('@neutrinojs/react');
const typescript = (options = {}) => (neutrino) => {
const { config } = neutrino
if (options.fork !== false) {
config.plugin('fork-ts-checker').
use(require("fork-ts-checker-webpack-plugin"), [
{
// checkSyntacticErrors: true,
// tslint: false,
project: path.resolve(__dirname, './client/tsconfig.json'),
// tsconfigRootDir: __dirname,
// ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
// sourceType: 'module', // Allows for the use of imports
//...options.forkChecker
},
]);
}
let ext = config.resolve.extensions;
ext.prepend('.ts');
ext.prepend('.tsx');
let babelOpts = config.module
.rule("compile")
.use("babel")
.get("options");
let tsOpts ={
configFile:path.resolve(neutrino.options.source,'tsconfig.json')
}
config.module.rule("ts")
.test(/\.tsx?$/)
.include
.add(neutrino.options.source)
.add(neutrino.options.tests)
.end()
.use("babel")
.loader(require.resolve("babel-loader"))
.options({ ...babelOpts, ...options.babel })
.end()
.use("tsc")
.loader(require.resolve("ts-loader"))
.options({ transpileOnly: options.fork !== false, ...options.ts,...tsOpts })
.end();
};
module.exports = {
options: {
// Override to root of project
root: __dirname,
// Override to relative directory, resolves to process.cwd() + website
root: 'client',
// Override to entry
source: './',
// absolute
output: '../app/public',
// index: 'index.tsx',
},
use: [
standard(),
// node(),
jest(),
react(),
//支持tsx
typescript({
fork: false,
}),
],
};