jetpack
Last commit date
3rd-party
9 years ago
_inc
1 year ago
bin
9 years ago
css
9 years ago
images
1 year ago
json-endpoints
9 years ago
languages
9 years ago
modules
1 year ago
sal
9 years ago
scss
9 years ago
sync
9 years ago
views
9 years ago
.svnignore
12 years ago
changelog.txt
9 years ago
class.frame-nonce-preview.php
9 years ago
class.jetpack-admin.php
9 years ago
class.jetpack-autoupdate.php
9 years ago
class.jetpack-bbpress-json-api-compat.php
9 years ago
class.jetpack-cli.php
9 years ago
class.jetpack-client-server.php
9 years ago
class.jetpack-client.php
9 years ago
class.jetpack-connection-banner.php
9 years ago
class.jetpack-constants.php
9 years ago
class.jetpack-data.php
9 years ago
class.jetpack-debugger.php
9 years ago
class.jetpack-error.php
10 years ago
class.jetpack-heartbeat.php
9 years ago
class.jetpack-idc.php
9 years ago
class.jetpack-ixr-client.php
10 years ago
class.jetpack-jitm.php
9 years ago
class.jetpack-modules-list-table.php
9 years ago
class.jetpack-network-sites-list-table.php
9 years ago
class.jetpack-network.php
9 years ago
class.jetpack-options.php
9 years ago
class.jetpack-post-images.php
9 years ago
class.jetpack-signature.php
9 years ago
class.jetpack-tracks.php
9 years ago
class.jetpack-twitter-cards.php
9 years ago
class.jetpack-user-agent.php
9 years ago
class.jetpack-xmlrpc-server.php
9 years ago
class.jetpack.php
9 years ago
class.json-api-endpoints.php
3 years ago
class.json-api.php
10 years ago
class.photon.php
9 years ago
composer.json
10 years ago
functions.compat.php
9 years ago
functions.gallery.php
10 years ago
functions.global.php
9 years ago
functions.opengraph.php
9 years ago
functions.photon.php
9 years ago
jetpack.php
1 year ago
json-api-config.php
10 years ago
json-endpoints.php
9 years ago
locales.php
9 years ago
readme.txt
1 year ago
require-lib.php
10 years ago
rest-api.md
9 years ago
uninstall.php
9 years ago
webpack.config.js
9 years ago
wpml-config.xml
10 years ago
webpack.config.js
117 lines
| 1 | require( 'es6-promise' ).polyfill(); |
| 2 | |
| 3 | var path = require( 'path' ); |
| 4 | var webpack = require( 'webpack' ); |
| 5 | var fs = require('fs'); |
| 6 | var NODE_ENV = process.env.NODE_ENV || 'development'; |
| 7 | var ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); |
| 8 | |
| 9 | var IS_HOT_UPDATE = ( process.env.NODE_ENV !== 'production' ); |
| 10 | |
| 11 | var jsLoader = IS_HOT_UPDATE ? |
| 12 | [ require.resolve( 'react-hot-loader' ), require.resolve( 'babel-loader' ), require.resolve( 'eslint-loader' ) ] : |
| 13 | [ require.resolve( 'babel-loader' ), require.resolve( "eslint-loader" ) ]; |
| 14 | |
| 15 | var cssLoader = IS_HOT_UPDATE ? |
| 16 | 'style!css?sourceMap!autoprefixer!' : |
| 17 | ExtractTextPlugin.extract( 'css?sourceMap!autoprefixer!' ); |
| 18 | |
| 19 | // This file is written in ES5 because it is run via Node.js and is not transpiled by babel. We want to support various versions of node, so it is best to not use any ES6 features even if newer versions support ES6 features out of the box. |
| 20 | var webpackConfig = { |
| 21 | |
| 22 | // Entry points point to the javascript module that is used to generate the script file. |
| 23 | // The key is used as the name of the script. |
| 24 | entry: { |
| 25 | admin: './_inc/client/admin.js', |
| 26 | static: './_inc/client/static.jsx' |
| 27 | }, |
| 28 | output: { |
| 29 | path: path.join( __dirname, '_inc/build' ), |
| 30 | filename: "[name].js" |
| 31 | }, |
| 32 | module: { |
| 33 | |
| 34 | // Webpack loaders are applied when a resource is matches the test case |
| 35 | loaders: [ |
| 36 | { |
| 37 | test: /\.jsx?$/, |
| 38 | loaders: jsLoader, |
| 39 | |
| 40 | // include both typical npm-linked locations and default module locations to handle both cases |
| 41 | include: [ |
| 42 | path.join( __dirname, 'test' ), |
| 43 | path.join( __dirname, '_inc/client' ), |
| 44 | fs.realpathSync( path.join( __dirname, './node_modules/@automattic/dops-components/client' ) ), |
| 45 | path.join( __dirname, './node_modules/@automattic/dops-components/client' ) |
| 46 | ] |
| 47 | }, |
| 48 | { |
| 49 | test: /\.json$/, |
| 50 | loader: 'json-loader' |
| 51 | }, |
| 52 | { |
| 53 | test: /\.css$/, |
| 54 | loader: cssLoader |
| 55 | }, |
| 56 | { |
| 57 | test: /\.html$/, |
| 58 | loader: 'html-loader' |
| 59 | }, |
| 60 | { |
| 61 | test: /\.scss$/, |
| 62 | loader: ExtractTextPlugin.extract( 'style-loader', 'css!sass' ) |
| 63 | } |
| 64 | ] |
| 65 | }, |
| 66 | resolve: { |
| 67 | extensions: [ '', '.js', '.jsx' ], |
| 68 | alias: { |
| 69 | "react": path.join(__dirname, "/node_modules/react") |
| 70 | }, |
| 71 | root: [ |
| 72 | path.resolve( __dirname, '_inc/client' ), |
| 73 | fs.realpathSync( path.join(__dirname, 'node_modules/@automattic/dops-components/client') ) |
| 74 | ] |
| 75 | }, |
| 76 | resolveLoader: { |
| 77 | root: path.join( __dirname, 'node_modules' ) |
| 78 | }, |
| 79 | node: { |
| 80 | fs: "empty", |
| 81 | process: true |
| 82 | }, |
| 83 | eslint: { |
| 84 | configFile: path.join(__dirname, '.eslintrc'), |
| 85 | quiet: true |
| 86 | }, |
| 87 | plugins: [ |
| 88 | new webpack.DefinePlugin({ |
| 89 | |
| 90 | // NODE_ENV is used inside React to enable/disable features that should only |
| 91 | // be used in development |
| 92 | 'process.env': { |
| 93 | NODE_ENV: JSON.stringify( NODE_ENV ) |
| 94 | } |
| 95 | }), |
| 96 | new ExtractTextPlugin( '[name].dops-style.css' ) |
| 97 | ], |
| 98 | externals: { |
| 99 | 'react/addons': true, |
| 100 | 'react/lib/ExecutionEnvironment': true, |
| 101 | 'react/lib/ReactContext': true, |
| 102 | jsdom: 'window' |
| 103 | } |
| 104 | }; |
| 105 | |
| 106 | if ( NODE_ENV === 'production' ) { |
| 107 | |
| 108 | webpack.DefinePlugin( { |
| 109 | "process.env": { |
| 110 | // This has effect on the react lib size |
| 111 | "NODE_ENV": JSON.stringify(process.env.NODE_ENV) // TODO switch depending on actual environment |
| 112 | } |
| 113 | } ); |
| 114 | } |
| 115 | |
| 116 | module.exports = webpackConfig; |
| 117 |