Skip to content

Commit

Permalink
chore(webpack): update to webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
tsur committed Jan 6, 2019
1 parent 1838664 commit 640b0e8
Show file tree
Hide file tree
Showing 6 changed files with 3,474 additions and 2,000 deletions.
15 changes: 10 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"presets": ["latest"],
"env": {
"test": {}
}
}
"presets": [
["@babel/preset-env", {
"loose": true,
"modules": "commonjs",
"targets": {
"node": "current"
}
}]
]
}
12 changes: 7 additions & 5 deletions internals/webpack/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const webpack = require('webpack');

module.exports = (options) => ({
entry: options.entry,
externals: options.externals,
output: Object.assign(
{
// Compile into js/build.js
Expand All @@ -15,20 +16,21 @@ module.exports = (options) => ({
options.output
), // Merge with env dependent settings
module: {
loaders: [
rules: [
{
test: /\.js$/, // Transform all .js files required somewhere with Babel
loader: 'babel-loader',
exclude: (modulePath) => modulePath.includes('node_modules'),
},
{
test: /\.json$/,
loader: 'json-loader',

},
{
test: /\.html$/,
loader: 'html-loader',
},
// {
// test: /\.json$/,
// loader: 'json-loader',
// },
{
// Do not transform vendor's CSS with CSS-modules
// The point is that they remain in global scope.
Expand Down
3 changes: 2 additions & 1 deletion internals/webpack/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const plugins = [
];

module.exports = require('./base')({
entry: ['babel-polyfill', path.join(process.cwd(), 'src/cli/index.js')],
// entry: ['babel-polyfill', path.join(process.cwd(), 'src/cli/index.js')],
entry: [path.join(process.cwd(), 'src/cli/index.js')],

// Don't use hashes in dev mode for better performance
output: {
Expand Down
11 changes: 10 additions & 1 deletion internals/webpack/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ const plugins = [
];

module.exports = require('./base')({
entry: ['babel-polyfill', path.join(process.cwd(), 'src/lib/index.js')],
// entry: ['babel-polyfill', path.join(process.cwd(), 'src/lib/index.js')],
entry: [path.join(process.cwd(), 'src/lib/index.js')],


externals : {
cheerio: 'cheerio',
lodash: 'lodash',
'isomorphic-fetch': 'isomorphic-fetch',

},

// Don't use hashes in dev mode for better performance
output: {
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"email": "[email protected]"
},
"name": "rae",
"version": "1.0.1",
"version": "1.0.2",
"description": "Simple Rae Dictionary Library",
"keywords": [
"dictionary",
Expand All @@ -24,12 +24,9 @@
"rae": "./build/cli.js"
},
"devDependencies": {
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-latest": "^6.24.1",
"babel-register": "^6.26.0",
"cheerio": "^1.0.0-rc.2",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"babel-loader": "^8.0.5",
"circular-dependency-plugin": "^4.2.1",
"clipboard": "^1.7.1",
"cp": "^0.2.0",
Expand All @@ -49,20 +46,24 @@
"html-webpack-plugin": "^2.30.1",
"htmlparser2": "^3.9.2",
"imports-loader": "^0.7.1",
"isomorphic-fetch": "^2.2.1",
"jest-cli": "^21.2.1",
"lodash": "^4.17.4",
"mocha": "^4.0.1",
"readline": "^1.3.0",
"rimraf": "^2.6.2",
"semantic-release": "^8.2.0",
"should": "^13.1.2",
"style-loader": "^0.19.0",
"uglifyjs-webpack-plugin": "^2.1.1",
"validate-commit-msg": "^2.14.0",
"webpack": "^3.8.1",
"webpack-bundle-analyzer": "^2.9.0"
"webpack": "^4.28.3",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-cli": "^3.2.0"
},
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4"
},
"dependencies": {},
"scripts": {
"pretest": "rimraf coverage",
"test": "cross-env NODE_ENV=test jest --coverage",
Expand Down
Loading

0 comments on commit 640b0e8

Please sign in to comment.