Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Upgrade webpack #86

Merged
merged 8 commits into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"presets": ["react", "es2015", "stage-2"],
"presets": ["react", ["es2015", {"modules": false}], "stage-2"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might consider preset-env?

"plugins": ["transform-decorators-legacy"],
"env": {
"development": {
"presets": ["react-hmre"]
},
"test": {
"plugins": ["transform-es2015-modules-commonjs"]
}
}
}
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"license": "Apache-2.0",
"scripts": {
"build": "rm -rf dist && mkdir -p dist/public && npm run build:assets && npm run build:html && npm run build:img && npm run build:ico",
"build:assets": "NODE_ENV=production webpack -p",
"build:assets": "NODE_ENV=production webpack -p --display-optimization-bailout",
"build:html": "cp public/*.html dist/.",
"build:ico": "cp public/*.ico dist/.",
"build:img": "cp public/*.png dist/public/.",
"start": "NODE_ENV=development webpack-dev-server --config webpack.config.js --progress --colors",
"start": "NODE_ENV=development webpack-dev-server --progress --colors --display-optimization-bailout",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webpack-dev-server says Unknown argument: display-optimization-bailout!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't actually test that... It can be removed, it's really just useful for production

"start:heroku": "UNLEASH_API=http://unleash.herokuapp.com npm run start",
"lint": "eslint . --ext js,jsx",
"test": "jest",
Expand Down Expand Up @@ -59,30 +59,29 @@
"devDependencies": {
"babel-core": "^6.14.0",
"babel-eslint": "^7.1.0",
"babel-loader": "^6.2.5",
"babel-loader": "^7.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-0": "^6.5.0",
"babel-preset-stage-2": "^6.13.0",
"css-loader": "^0.25.0",
"css-loader": "^0.28.4",
"eslint": "^4.1.1",
"eslint-config-finn": "^2.0.0",
"eslint-config-finn-react": "^2.0.0",
"eslint-plugin-react": "^7.1.0",
"extract-text-webpack-plugin": "^1.0.1",
"extract-text-webpack-plugin": "^3.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^20.0.4",
"node-sass": "~3.12.1",
"postcss-loader": "^0.13.0",
"node-sass": "^4.5.3",
"react-test-renderer": "^15.4.2",
"redux-devtools": "^3.3.1",
"sass-loader": "^4.0.2",
"style-loader": "^0.13.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"toolbox-loader": "0.0.3",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.15.1"
"webpack": "^3.1.0",
"webpack-dev-server": "^2.5.1"
},
"jest": {
"moduleNameMapper": {
Expand Down
4 changes: 2 additions & 2 deletions src/component/feature/form/strategy-configure.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class StrategyConfigure extends React.Component {
</CardText>
{
inputFields && <CardActions border style={{ padding: '20px' }}>
{inputFields}
</CardActions>
{inputFields}
</CardActions>
}

<CardMenu className="mdl-color-text--white">
Expand Down
2 changes: 1 addition & 1 deletion src/data/applications-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function storeApplicationMetaData (appName, key, value) {
}).then(throwIfNotSuccess);
}

module.exports = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these import/export changes were because webpack complained

export default {
fetchApplication,
fetchAll,
fetchApplicationsWithStrategyName,
Expand Down
2 changes: 1 addition & 1 deletion src/data/archive-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function revive (featureName) {
}


module.exports = {
export default {
fetchAll,
revive,
};
Expand Down
2 changes: 1 addition & 1 deletion src/data/client-instance-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ function fetchAll () {
.then(response => response.json());
}

module.exports = {
export default {
fetchAll,
};
2 changes: 1 addition & 1 deletion src/data/feature-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function remove (featureToggleName) {
}).then(throwIfNotSuccess);
}

module.exports = {
export default {
fetchAll,
create,
validate,
Expand Down
2 changes: 1 addition & 1 deletion src/data/feature-metrics-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function fetchSeenApps () {
.then(response => response.json());
}

module.exports = {
export default {
fetchFeatureMetrics,
fetchSeenApps,
};
2 changes: 1 addition & 1 deletion src/data/history-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function fetchHistoryForToggle (toggleName) {
.then(response => response.json());
}

module.exports = {
export default {
fetchAll,
fetchHistoryForToggle,
};
2 changes: 1 addition & 1 deletion src/data/strategy-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function remove (strategy) {
}).then(throwIfNotSuccess);
}

module.exports = {
export default {
fetchAll,
create,
update,
Expand Down
4 changes: 2 additions & 2 deletions src/store/strategy/actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '../../data/strategy-api';
import { fetchApplicationsWithStrategyName } from '../../data/applications-api';
import applicationApi from '../../data/applications-api';

export const ADD_STRATEGY = 'ADD_STRATEGY';
export const UPDATE_STRATEGY = 'UPDATE_STRATEGY';
Expand Down Expand Up @@ -83,6 +83,6 @@ export function removeStrategy (strategy) {
}

export function getApplicationsWithStrategy (strategyName) {
return fetchApplicationsWithStrategyName(strategyName);
return applicationApi.fetchApplicationsWithStrategyName(strategyName);
}

42 changes: 26 additions & 16 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const plugins = [
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
},
}),
new webpack.optimize.ModuleConcatenationPlugin(),
];

if (process.env.NODE_ENV === 'development') {
Expand All @@ -25,8 +26,7 @@ module.exports = {
entry,

resolve: {
root: [path.join(__dirname, 'src')],
extensions: ['', '.scss', '.css', '.js', '.jsx', '.json'],
extensions: ['.scss', '.css', '.js', '.jsx', '.json'],
},

output: {
Expand All @@ -36,38 +36,48 @@ module.exports = {
},

module: {
loaders: [
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
loader: 'babel-loader',
include: path.join(__dirname, 'src'),
},
{
test: /(\.scss)$/,
loader: ExtractTextPlugin.extract('style',
'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass'),
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true,
modules: true,
importLoaders: 1,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
{
loader: 'sass-loader',
options: {
// data: '@import "theme/_config.scss";',
includePaths: [path.resolve(__dirname, './src')],
},
},
],
}),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css'),
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }),
},
],
},

plugins,

sassLoader: {
// data: '@import "theme/_config.scss";',
includePaths: [path.resolve(__dirname, './src')],
},

devtool: 'source-map',

externals: {
// stuff not in node_modules can be resolved here.
},

devServer: {
proxy: {
'/api': {
Expand Down
Loading