Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
webf
react-webf
Commits
8c95163e
Commit
8c95163e
authored
May 07, 2020
by
Mickaël Bourgier
Browse files
🔥
Remove unnecessary compilation code
parent
b5b3dd8d
Pipeline
#1773
passed with stage
in 1 minute and 40 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
babel.config.js
View file @
8c95163e
const
test
=
process
.
env
.
NODE_ENV
===
'
test
'
;
const
cjs
=
process
.
env
.
BABEL_ENV
===
'
cjs
'
;
const
es
=
process
.
env
.
BABEL_ENV
===
'
es
'
;
module
.
exports
=
{
presets
:
[
[
'
@babel/preset-env
'
,
{
modules
:
test
||
cjs
?
'
cjs
'
:
false
,
},
],
'
@babel/preset-react
'
,
],
presets
:
[[
'
@babel/preset-env
'
,
{
modules
:
false
}],
'
@babel/preset-react
'
],
plugins
:
[
'
@babel/plugin-proposal-class-properties
'
,
'
dev-expression
'
],
ignore
:
[
...(
cjs
||
es
?
[
/demos
\/
.+
\.
js/
]
:
[]),
...(
test
?
[]
:
[
/
\.
test
\.
js/
]),
],
};
package.json
View file @
8c95163e
...
...
@@ -31,8 +31,8 @@
"build:cjs"
:
"tsc --rootDir ./src --outDir ./dist --declaration"
,
"build:es"
:
"tsc --rootDir ./src --outDir ./dist/es --declaration --target ES6 --moduleResolution node"
,
"build:check"
:
"tsc --noEmit"
,
"dev"
:
"
WEBPACK_TARGET=docs
yarn docs:dev"
,
"docs:build"
:
"rm -rf docs/dist && NODE_ENV=production
WEBPACK_TARGET=docs
webpack"
,
"dev"
:
"yarn docs:dev"
,
"docs:build"
:
"rm -rf docs/dist && NODE_ENV=production webpack"
,
"docs:dev"
:
"webpack-dev-server --hot"
,
"lint"
:
"eslint './docs/**/*.{js,ts,tsx}' './src/**/*.{js,ts,tsx}'"
,
"prepublishOnly"
:
"yarn prettier:check && yarn lint && yarn build"
,
...
...
webpack.config.js
View file @
8c95163e
/* eslint-disable @typescript-eslint/no-var-requires */
const
path
=
require
(
'
path
'
);
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
);
const
HtmlWebpackHarddiskPlugin
=
require
(
'
html-webpack-harddisk-plugin
'
);
const
UglifyJsPlugin
=
require
(
'
uglifyjs-webpack-plugin
'
);
const
production
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
docs
=
process
.
env
.
WEBPACK_TARGET
===
'
docs
'
;
module
.
exports
=
{
context
:
__dirname
,
mode
:
production
?
'
production
'
:
'
development
'
,
entry
:
docs
?
{
[
`app
${
production
?
'
.min
'
:
''
}
`
]:
path
.
resolve
(
__dirname
,
'
docs/src/index.js
'
),
}
:
{
'
react.webf
'
:
path
.
resolve
(
__dirname
,
'
src/index.js
'
),
...(
production
?
{
'
react.webf.min
'
:
path
.
resolve
(
__dirname
,
'
src/index.js
'
)
}
:
{}),
},
entry
:
{
[
`app
${
production
?
'
.min
'
:
''
}
`
]:
path
.
resolve
(
__dirname
,
'
docs/src/index.js
'
),
},
output
:
{
filename
:
'
[name].js
'
,
path
:
path
.
resolve
(
__dirname
,
docs
?
'
docs/dist
'
:
'
dist
'
),
path
:
path
.
resolve
(
__dirname
,
'
docs/
dist
'
),
publicPath
:
'
/
'
,
},
...
...
@@ -59,19 +52,17 @@ module.exports = {
],
},
plugins
:
docs
?
[
new
HtmlWebpackPlugin
({
alwaysWriteToDisk
:
true
,
hash
:
true
,
meta
:
{
viewport
:
'
width=device-width, initial-scale=1, shrink-to-fit=no
'
,
},
template
:
path
.
resolve
(
__dirname
,
'
docs/static/index.html
'
),
}),
new
HtmlWebpackHarddiskPlugin
(),
]
:
[],
plugins
:
[
new
HtmlWebpackPlugin
({
alwaysWriteToDisk
:
true
,
hash
:
true
,
meta
:
{
viewport
:
'
width=device-width, initial-scale=1, shrink-to-fit=no
'
,
},
template
:
path
.
resolve
(
__dirname
,
'
docs/static/index.html
'
),
}),
new
HtmlWebpackHarddiskPlugin
(),
],
resolve
:
{
alias
:
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment