-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add npm commands for dev and fix hotreloading #179
Changes from all commits
53f492d
e4e5bbc
ff1d9ff
6e25b05
1e163e5
845bcd9
fbfc9cf
e9934e2
e3a1930
f0b492c
036a38b
a8d1967
3a74514
237ec14
0c1a3bc
b6bb6d8
a45139b
2790e04
595906e
08322ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
/** @format */ | ||
const path = require( 'path' ); | ||
const webpack = require( 'webpack' ); | ||
const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' ); | ||
|
||
module.exports = { | ||
const env = process.env.NODE_ENV; | ||
|
||
const config = { | ||
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. Not sure if I should mention this here as I've already mentioned it in the first PR: I'd prefer that targets were independent of each other. We should have a 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. Yes you did, and this was fixed in the base PR. |
||
entry: './targets/wordpress/index.js', | ||
output: { | ||
filename: './targets/wordpress/assets/happychat.js', | ||
filename: 'happychat.js', | ||
path: path.resolve( __dirname, 'targets/wordpress/assets' ), | ||
}, | ||
module: { | ||
rules: [ | ||
|
@@ -18,11 +22,27 @@ module.exports = { | |
}, | ||
plugins: [ | ||
new webpack.DefinePlugin( { | ||
'process.env.NODE_ENV': JSON.stringify( 'development' ), | ||
'process.env.NODE_ENV': JSON.stringify( env ), | ||
} ), | ||
], | ||
resolve: { | ||
extensions: [ '.js', '.jsx' ], | ||
modules: [ path.resolve( __dirname ), path.resolve( __dirname, 'node_modules' ) ], | ||
}, | ||
}; | ||
|
||
switch ( env ) { | ||
case 'development': | ||
config.devtool = 'source-map'; | ||
config.devServer = { | ||
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. Do we use the development server in this case? 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. I haven't actually tried it, but it should be helpful to serve local css while developing a wordpress plugin. |
||
port: 9000, | ||
}; | ||
break; | ||
|
||
case 'production': | ||
config.plugins.push( new webpack.optimize.ModuleConcatenationPlugin() ); | ||
config.plugins.push( new UglifyJsPlugin() ); | ||
break; | ||
} | ||
|
||
module.exports = config; |
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.
❤️ we should merge this piece right away!