This repository was archived by the owner on Jun 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Upgrade to webpack 4. #111
Open
pattiereaves
wants to merge
27
commits into
main
Choose a base branch
from
webpack-4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
35cc05d
Working build, even if the processes aren't working.
e04e749
Fix webpack config so it will load.
816dd4c
Working to the point of 'cannot find uglify plugin'
23eff04
Refactor function to work for build and watch tasks.
pattiereaves 5bb5f38
Remove unnecessary eslint disables.
pattiereaves e60f845
Bump package version to 3.0
pattiereaves dcf332a
Fix semantic versioning.
3ac65b4
Add travis.yml
ostowe 29c5281
Woops, rename to `.travis.yml`!
ostowe 93cb4ff
Fix html-webpack-plugin reference
ostowe acf20dd
Reinstall html-webpack-plugin
ostowe 2a49309
Move webpack-cli into dependencies (not devDependencies)
ostowe 644ba94
Move everything into dependencies for travis' sake
ostowe ab0572b
Restore exclusion on node_modules.
ce80cee
Put console func on same line.
b306f14
Make this more readable.
d2d7fb1
Merge remote-tracking branch 'origin/webpack-4' into webpack-4
de9b7bd
Non-working attempt at redoing classnames as a single file.
f55dfe2
Fix mysterious error where bundle was not injected properly.
pattiereaves dbdd8ec
Refactor so that it will use a single filepath for css modules.
pattiereaves 053ca1f
Fresh build.
7655ed0
Code review recommendations.
141a76c
Remove commented line.
60064f7
Merge remote-tracking branch 'origin/fix-for-postcss-modules' into fi…
fc99272
Update documentation.
bc0c41c
Make this sound like a normal human wrote it.
eac6cfe
Merge pull request #112 from alleyinteractive/fix-for-postcss-modules
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ | |
| "plugins": [ | ||
| "jest" | ||
| ], | ||
| // Do NOT change these rules | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😂🙅🚫💅 |
||
| "rules": { | ||
| "indent": [2, 2, {"SwitchCase": 1}], | ||
| "max-len": [2, 80, 4, { | ||
|
|
@@ -64,5 +63,6 @@ | |
| "no-constant-condition": ["error"], | ||
| "arrow-parens": ["error", "always"], | ||
| "no-console": 0, | ||
| "function-paren-newline": 0, | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| sudo: false | ||
| dist: trusty | ||
| language: node_js | ||
|
|
||
| node_js: | ||
| - 8 | ||
|
|
||
| env: | ||
| global: | ||
| - NODE_ENV=production | ||
|
|
||
| branches: | ||
| only: | ||
| - master | ||
| - beta | ||
|
|
||
| notifications: | ||
| email: false | ||
|
|
||
| # Ensure node and npm major version matches from package.json | ||
| before_install: | ||
| - nvm install "$(jq -r '.engines.node' package.json | egrep -oe "[0-9]+" | head -n1)" | ||
| - npm i -g npm@$(jq -r '.engines.npm' package.json | egrep -oe "[0-9]+" | head -n1) | ||
|
|
||
| install: | ||
| - npm ci | ||
|
|
||
| cache: | ||
| directories: | ||
| - "$HOME/.npm" | ||
|
|
||
| script: | ||
| - npm run build | ||
| - sleep 10 # Give server enough time to spin up | ||
|
|
||
| # Disabling sanity test curl test until REACT_APP_WPAPI_ROOT is ready | ||
| # - curl -s --fail "http://localhost:3001" > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| At this point contribution guidelines are limited. This document contains information on setting up and developing locally; otherwise the primary concern for contributors is whether or not you are a member of the Alley Interactive organization (Huron's sponsor). | ||
|
|
||
| ## Development | ||
| There are two primary comonents to Huron: the CLI and the web (browser) script. Since each of these is used for different purposes, there is a different build pipeline for each. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All changes in this file are correcting typos |
||
| There are two primary components to Huron: the CLI and the web (browser) script. Since each of these is used for different purposes, there is a different build pipeline for each. | ||
|
|
||
| Generally speaking, there are three NPM scripts you'll need to compile the Huron source: | ||
| * `dev-cli`: This script will start Webpack for the CLI (`/src/cli`) only using Webpack's watcher. Hot Module Reloading is also enabled with this script. | ||
|
|
@@ -14,7 +14,7 @@ Generally speaking, there are three NPM scripts you'll need to compile the Huron | |
| In order to allow users to reference the `.bin` version of the Huron cli via NPM, we need to bundle the CLI into a single `.js` file. To do this we utilize an internal Webpack install, for which the configuration is located in `/config/webpack-node.config.js`. As detailed above, you should use the `dev-cli` command during development, as this will allow you to hot reload your changes. Currently there is no HMR handling for the CLI scripts, so this functionality may be buggy. | ||
|
|
||
| ### Web | ||
| Huron's browser-facing scripts will run through the user's own (or Huron's default) Webpack configuration and, as such, cannot be pre-compiled by Webpack. Therefore, we simply transpile the source for the web scripts using babel-cli to ensure some measure of browser compatibility. Note: At some point, it may be worth exploring further the possibility of dynamically inserting the babel-loader specifically for the huron web scripts when the user run's the CLI. | ||
| Huron's browser-facing scripts will run through the user's own (or Huron's default) Webpack configuration and, as such, cannot be pre-compiled by Webpack. Therefore, we simply transpile the source for the web scripts using babel-cli to ensure some measure of browser compatibility. Note: At some point, it may be worth exploring further the possibility of dynamically inserting the babel-loader specifically for the huron web scripts when the user runs the CLI. | ||
|
|
||
| ## Submitting your changes | ||
| Note for all new package versions: the github release should _always_ match the corresponding release to NPM. In addition, publishes from the `beta` branch must always include a `-beta.0` after the version number to indicate a beta pre-release. In addition, generally speaking, every merge of a Pull Request should be associated with a version bump. If you are writing changes for documentation only, a version bump is not necessary. When working on changes for Huron, please follow these guildelines: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,49 @@ | ||
| /* eslint-disable import/no-extraneous-dependencies */ | ||
| // Requires | ||
| const webpack = require('webpack'); | ||
| const path = require('path'); | ||
| /* eslint-disable */ | ||
| const nodeExternals = require('webpack-node-externals'); | ||
| const CleanPlugin = require('clean-webpack-plugin'); | ||
| /* eslint-enable */ | ||
|
|
||
| module.exports = function getConfig(env) { | ||
| const context = path.join(__dirname, '../'); | ||
|
|
||
| return { | ||
| context, | ||
| entry: { | ||
| cli: ['./src/cli/index'], | ||
| }, | ||
| plugins: [ | ||
| new CleanPlugin(['dist/cli'], { | ||
| root: context, | ||
| exclude: 'index.js', | ||
| }), | ||
| module.exports = { | ||
| context: path.join(__dirname, '../'), | ||
| entry: { | ||
| cli: ['./src/cli/index'], | ||
| }, | ||
| plugins: [ | ||
| new CleanPlugin(['dist/cli'], { | ||
| root: path.join(__dirname, '../'), | ||
| exclude: 'index.js', | ||
| }), | ||
| ], | ||
| target: 'node', | ||
| devtool: 'cheap-module-source-map', | ||
| output: { | ||
| path: path.join(__dirname, '../dist/cli'), | ||
| filename: 'index.js', | ||
| chunkFilename: '[name].chunk.min.js', | ||
| publicPath: '../', | ||
| }, | ||
| externals: ['localConfig', 'localHuron'].concat(nodeExternals({ | ||
| whitelist: [/webpack\/hot/], | ||
| })), | ||
| node: { | ||
| __filename: false, | ||
| __dirname: false, | ||
| }, | ||
| module: { | ||
| noParse: [/requireExternal/], | ||
| rules: [ | ||
| { | ||
| enforce: 'pre', | ||
| test: /\.js$/, | ||
| exclude: [/\.min\.js$/], | ||
| use: 'eslint-loader', | ||
| }, | ||
| { | ||
| test: /\.js$/, | ||
| exclude: [/\.min\.js$/], | ||
| use: 'babel-loader', | ||
| }, | ||
| ], | ||
| target: 'node', | ||
| devtool: 'cheap-module-source-map', | ||
| output: { | ||
| path: path.join(context, 'dist/cli'), | ||
| filename: 'index.js', | ||
| chunkFilename: '[name].chunk.min.js', | ||
| publicPath: '../', | ||
| }, | ||
| externals: ['localConfig', 'localHuron'].concat(nodeExternals({ | ||
| whitelist: [/webpack\/hot/], | ||
| })), | ||
| node: { | ||
| __filename: false, | ||
| __dirname: false, | ||
| }, | ||
| module: { | ||
| noParse: [/requireExternal/], | ||
| rules: [ | ||
| { | ||
| enforce: 'pre', | ||
| test: /\.js$/, | ||
| exclude: [/node_modules/, /\.min\.js$/], | ||
| use: 'eslint-loader', | ||
| }, | ||
| { | ||
| test: /\.js$/, | ||
| exclude: [/node_modules/, /\.min\.js$/], | ||
| use: 'babel-loader', | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
| }, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some reason, this is the only way I could get the tests to work?! I don't understand why it wasn't necessary for the cli.