Created
September 14, 2018 18:07
-
-
Save edmorley/32f3955f21d58a4efe5b17650a822485 to your computer and use it in GitHub Desktop.
React+AirBnB Neutrino presets export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
mode: 'production', | |
target: 'web', | |
context: 'C:\\Users\\Ed\\src\\test-project', | |
stats: { | |
children: false, | |
entrypoints: false, | |
modules: false | |
}, | |
node: { | |
Buffer: false, | |
fs: 'empty', | |
tls: 'empty' | |
}, | |
output: { | |
path: 'C:\\Users\\Ed\\src\\test-project\\build', | |
publicPath: './', | |
filename: '[name].[contenthash:8].js', | |
chunkFilename: '[name].[contenthash:8].js' | |
}, | |
resolve: { | |
alias: { | |
'react-native': 'react-native-web' | |
}, | |
extensions: [ | |
'.web.jsx', | |
'.web.js', | |
'.wasm', | |
'.mjs', | |
'.vue', | |
'.jsx', | |
'.tsx', | |
'.ts', | |
'.js', | |
'.json' | |
] | |
}, | |
module: { | |
rules: [ | |
/* neutrino.config.module.rule('lint') */ | |
{ | |
test: /\.(wasm|mjs|vue|jsx|tsx|ts|js)$/, | |
enforce: 'pre', | |
include: [ | |
'C:\\Users\\Ed\\src\\test-project\\src', | |
'C:\\Users\\Ed\\src\\test-project\\test' | |
], | |
use: [ | |
/* neutrino.config.module.rule('lint').use('eslint') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\eslint-loader\\index.js', | |
options: { | |
cache: true, | |
failOnError: true, | |
cwd: 'C:\\Users\\Ed\\src\\test-project', | |
useEslintrc: false, | |
root: true, | |
formatter: require('eslint/lib/formatters/codeframe'), | |
plugins: [ | |
'babel', | |
'react', | |
'jest' | |
], | |
baseConfig: { | |
'extends': [ | |
'C:\\Users\\Ed\\src\\neutrino\\node_modules\\eslint-config-airbnb\\index.js' | |
] | |
}, | |
envs: [ | |
'es6', | |
'browser', | |
'commonjs', | |
'jest/globals' | |
], | |
parser: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\babel-eslint\\lib\\index.js', | |
parserOptions: { | |
ecmaVersion: 2018, | |
sourceType: 'module' | |
}, | |
settings: {}, | |
globals: [ | |
'process' | |
], | |
rules: { | |
'new-cap': 'off', | |
'no-invalid-this': 'off', | |
'object-curly-spacing': 'off', | |
semi: 'off', | |
'no-unused-expressions': 'off', | |
'babel/new-cap': [ | |
'error', | |
{ | |
newIsCap: true, | |
newIsCapExceptions: [], | |
capIsNew: false, | |
capIsNewExceptions: [ | |
'Immutable.Map', | |
'Immutable.Set', | |
'Immutable.List' | |
] | |
} | |
], | |
'babel/no-invalid-this': 'off', | |
'babel/object-curly-spacing': [ | |
'error', | |
'always' | |
], | |
'babel/semi': [ | |
'error', | |
'always' | |
], | |
'babel/no-unused-expressions': [ | |
'error', | |
{ | |
allowShortCircuit: false, | |
allowTernary: false, | |
allowTaggedTemplates: false | |
} | |
], | |
'jest/no-disabled-tests': 'warn', | |
'jest/no-focused-tests': 'error', | |
'jest/no-identical-title': 'error', | |
'jest/valid-expect': 'error' | |
} | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('html') */ | |
{ | |
test: /\.html$/, | |
use: [ | |
/* neutrino.config.module.rule('html').use('html') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\html-loader\\index.js', | |
options: { | |
attrs: [ | |
'img:src', | |
'link:href' | |
] | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('compile') */ | |
{ | |
test: /\.(wasm|mjs|vue|jsx|tsx|ts|js)$/, | |
include: [ | |
'C:\\Users\\Ed\\src\\test-project\\src', | |
'C:\\Users\\Ed\\src\\test-project\\test' | |
], | |
use: [ | |
/* neutrino.config.module.rule('compile').use('babel') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\babel-loader\\lib\\index.js', | |
options: { | |
cacheDirectory: true, | |
babelrc: false, | |
presets: [ | |
[ | |
'C:\\Users\\Ed\\src\\neutrino\\node_modules\\@babel\\preset-env\\lib\\index.js', | |
{ | |
debug: false, | |
useBuiltIns: 'entry', | |
targets: { | |
browsers: [ | |
'last 2 Chrome versions', | |
'last 2 Firefox versions', | |
'last 2 Edge versions', | |
'last 2 Opera versions', | |
'last 2 Safari versions', | |
'last 2 iOS versions' | |
] | |
} | |
} | |
], | |
[ | |
'C:\\Users\\Ed\\src\\neutrino\\node_modules\\@babel\\preset-react\\lib\\index.js', | |
{ | |
development: false, | |
useBuiltIns: true | |
} | |
] | |
], | |
plugins: [ | |
'C:\\Users\\Ed\\src\\neutrino\\node_modules\\@babel\\plugin-syntax-dynamic-import\\lib\\index.js', | |
[ | |
'C:\\Users\\Ed\\src\\neutrino\\node_modules\\@babel\\plugin-proposal-class-properties\\lib\\index.js', | |
{ | |
loose: true | |
} | |
] | |
] | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('style') */ | |
{ | |
test: /\.css$/, | |
exclude: [ | |
/\.module\.css$/ | |
], | |
use: [ | |
/* neutrino.config.module.rule('style').use('extract') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\mini-css-extract-plugin\\dist\\loader.js' | |
}, | |
/* neutrino.config.module.rule('style').use('css') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\css-loader\\index.js', | |
options: { | |
importLoaders: 0 | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('style-modules') */ | |
{ | |
test: /\.module\.css$/, | |
use: [ | |
/* neutrino.config.module.rule('style-modules').use('extract-modules') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\mini-css-extract-plugin\\dist\\loader.js' | |
}, | |
/* neutrino.config.module.rule('style-modules').use('css-modules') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\css-loader\\index.js', | |
options: { | |
importLoaders: 0, | |
modules: true | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('font') */ | |
{ | |
test: /\.(eot|ttf|woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, | |
use: [ | |
/* neutrino.config.module.rule('font').use('file') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\file-loader\\dist\\cjs.js', | |
options: { | |
name: '[name].[hash:8].[ext]' | |
} | |
} | |
] | |
}, | |
/* neutrino.config.module.rule('image') */ | |
{ | |
test: /\.(ico|png|jpg|jpeg|gif|svg|webp)(\?v=\d+\.\d+\.\d+)?$/, | |
use: [ | |
/* neutrino.config.module.rule('image').use('url') */ | |
{ | |
loader: 'C:\\Users\\Ed\\src\\neutrino\\node_modules\\url-loader\\dist\\cjs.js', | |
options: { | |
limit: 8192, | |
name: '[name].[hash:8].[ext]' | |
} | |
} | |
] | |
} | |
] | |
}, | |
optimization: { | |
minimize: true, | |
splitChunks: { | |
chunks: 'all', | |
maxInitialRequests: 5, | |
name: false | |
}, | |
runtimeChunk: 'single' | |
}, | |
plugins: [ | |
/* neutrino.config.plugin('html-index') */ | |
new (require('C:\\Users\\Ed\\src\\neutrino\\node_modules\\html-webpack-plugin\\index.js'))( | |
{ | |
template: 'C:\\Users\\Ed\\src\\neutrino\\packages\\html-template\\template.ejs', | |
appMountId: 'root', | |
lang: 'en', | |
meta: { | |
viewport: 'width=device-width, initial-scale=1' | |
}, | |
minify: { | |
useShortDoctype: true, | |
keepClosingSlash: true, | |
collapseWhitespace: true, | |
preserveLineBreaks: true | |
}, | |
filename: 'index.html', | |
chunks: [ | |
'index' | |
], | |
title: 'test-project' | |
} | |
), | |
/* neutrino.config.plugin('extract') */ | |
new (require('C:\\Users\\Ed\\src\\neutrino\\node_modules\\mini-css-extract-plugin\\dist\\cjs.js'))( | |
{ | |
filename: '[name].[contenthash:8].css' | |
} | |
), | |
/* neutrino.config.plugin('clean') */ | |
new (require('C:\\Users\\Ed\\src\\neutrino\\node_modules\\clean-webpack-plugin\\index.js'))( | |
[ | |
'C:\\Users\\Ed\\src\\test-project\\build' | |
], | |
{ | |
root: 'C:\\Users\\Ed\\src\\test-project', | |
verbose: false, | |
allowExternal: false, | |
dry: false | |
} | |
) | |
], | |
entry: { | |
index: [ | |
'C:\\Users\\Ed\\src\\test-project\\src\\index' | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment