File tree Expand file tree Collapse file tree 5 files changed +126
-1
lines changed
Expand file tree Collapse file tree 5 files changed +126
-1
lines changed Original file line number Diff line number Diff line change 1+ # http://EditorConfig.org
2+ root = true
3+ charset = utf-8
4+ indent_style = tab
5+ trim_trailing_whitespace = true
6+ end_of_line = crlf
7+ insert_final_new_line = true
8+
9+ [* .md ]
10+ trim_trailing_whitespace = false
11+
12+ # 2 spaces
13+ [* .json ]
14+ indent_style = space
15+ indent_size = 2
16+
17+ [* .lock ]
18+ indent_style = space
19+ indent_size = 2
20+
21+ [* .yml ]
22+ indent_style = space
23+ indent_size = 2
24+
25+ # 4 spaces
26+ [* .php ]
27+ indent_style = space
28+ indent_size = 4
Original file line number Diff line number Diff line change 1+ .idea
2+ .vscode
3+
4+ * .log *
5+ .DS_Store
6+ thumbs.db
7+ * .ipr
8+ * .iws
Original file line number Diff line number Diff line change 11# babel-loader-exclude-node-modules-except
2- Creating a regular expression for excluding node modules from transpiling except for individual modules
2+
3+ > Creating a regular expression for excluding node_modules
4+ > from babel transpiling except for individual modules
5+
6+
7+ ### Usage
8+
9+ ``` js
10+ // webpack.config.js
11+
12+ import babelLoaderExcludeNodeModulesExcept from ' babel-loader-exclude-node-modules-except' ;
13+
14+ export default {
15+ // webpack config
16+ // ...
17+ module: {
18+ rules: [
19+ {
20+ test: / \. js$ / ,
21+ exclude: babelLoaderExcludeNodeModulesExcept ([
22+ // es6 modules from node_modules/
23+ ' custom-jquery-methods' ,
24+ ' swiper' ,
25+ ' dom7'
26+ ]),
27+ use: {
28+ loader: ' babel-loader'
29+ }
30+ }
31+ ]
32+ }
33+ };
34+
35+ ```
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ /**
4+ * @module
5+ * @author Oleg Dutchenko <[email protected] > 6+ * @version 1.0.0
7+ */
8+
9+ // ----------------------------------------
10+ // Public
11+ // ----------------------------------------
12+
13+ /**
14+ * Creating a regular expression for excluding node modules
15+ * from babel transpiling except for individual modules
16+ * @param {string[] } [exceptionList] - exclude all modules except this list
17+ * @return {RegExp }
18+ */
19+ function babelLoaderExcludeNodeModulesExcept ( exceptionList ) {
20+ if ( Array . isArray ( exceptionList ) && exceptionList . length ) {
21+ return new RegExp ( `node_modules[\\/|\\\\](?!(${ exceptionList . join ( '|' ) } )).*` , 'i' ) ;
22+ }
23+ return / n o d e _ m o d u l e s / i;
24+ }
25+
26+ // ----------------------------------------
27+ // Exports
28+ // ----------------------------------------
29+
30+ module . exports = babelLoaderExcludeNodeModulesExcept ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " babel-loader-exclude-node-modules-except" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " Creating a regular expression for excluding node_modules from babel transpiling except for individual modules" ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "repository" : {
10+ "type" : " git" ,
11+ "url" : " git+https://github.com/WezomAgency/babel-loader-exclude-node-modules-except.git"
12+ },
13+ "keywords" : [
14+ " webpack" ,
15+ " babel-loader" ,
16+ " exclude" ,
17+ " node_modules" ,
18+ " es6 modules"
19+ ],
20+ "author" :
" Oleg Dutchenko <[email protected] >" ,
21+ "license" : " MIT" ,
22+ "bugs" : {
23+ "url" : " https://github.com/WezomAgency/babel-loader-exclude-node-modules-except/issues"
24+ },
25+ "homepage" : " https://github.com/WezomAgency/babel-loader-exclude-node-modules-except#readme"
26+ }
You can’t perform that action at this time.
0 commit comments