fix webpack config ts issues

This commit is contained in:
Roman Hotsiy 2017-11-19 23:26:41 +02:00
parent 08034dc05f
commit f7374caf3c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
4 changed files with 16 additions and 10 deletions

View File

@ -12,7 +12,6 @@ env:
addons: addons:
chrome: stable chrome: stable
cache: yarn cache: yarn
before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
before_script: npm run bundle before_script: npm run bundle
deploy: deploy:
- provider: npm - provider: npm

View File

@ -16,8 +16,8 @@
"e2e:clean": "rimraf e2e/.build", "e2e:clean": "rimraf e2e/.build",
"cy:open": "cypress open", "cy:open": "cypress open",
"bundle:clean": "rimraf bundles", "bundle:clean": "rimraf bundles",
"bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod ", "bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod",
"bundle:lib": "webpack -p --env.lib --env.prod ", "bundle:lib": "webpack -p --env.lib --env.prod",
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone", "bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
"stats": "webpack -p --env.prod --json --profile > stats.json", "stats": "webpack -p --env.prod --json --profile > stats.json",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"" "prettier": "prettier --write \"src/**/*.{ts,tsx}\""

View File

@ -1,7 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, "experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"target": "es5", "target": "es5",
"noImplicitAny": false, "noImplicitAny": false,

View File

@ -1,4 +1,4 @@
import webpack from 'webpack'; import * as webpack from 'webpack';
import * as HtmlWebpackPlugin from 'html-webpack-plugin'; import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as nodeExternals from 'webpack-node-externals'; import * as nodeExternals from 'webpack-node-externals';
@ -54,7 +54,15 @@ export default env => {
rules: [ rules: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
loaders: ['react-hot-loader/webpack', 'awesome-typescript-loader'], use: [
'react-hot-loader/webpack',
{
loader: 'awesome-typescript-loader',
options: {
module: 'es2015',
},
},
],
exclude: ['node_modules'], exclude: ['node_modules'],
}, },
{ {
@ -89,7 +97,7 @@ export default env => {
}; };
if (env.prod) { if (env.prod) {
config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin()); config.plugins!.push(new webpack.optimize.ModuleConcatenationPlugin());
} }
if (env.lib) { if (env.lib) {
@ -98,10 +106,10 @@ export default env => {
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i], whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
}); });
config.output.library = 'Redoc'; config.output!.library = 'Redoc';
config.output.libraryTarget = 'umd'; config.output!.libraryTarget = 'umd';
} else { } else {
config.plugins.push( config.plugins!.push(
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './demo/playground/index.html', template: './demo/playground/index.html',
}), }),