I'm so confuse how to setting up my project to deploy my project to my development server. I got a problem after I upload my files to the server.
this is what my browser shows if i open my website url. I read some post in stackoverflow How to deploy a React App on Apache web server and tells that I need to npm run build. Yes I tried it but my terminal says
missing build script
I have question do i need to configure the htaccess? I don't know where to configure in laravel or in react?
Here's my package.json file
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build": "webpack --mode production"
},
"devDependencies": {
"#babel/plugin-proposal-class-properties": "^7.1.0",
"axios": "^0.18.0",
"babel-eslint": "^8.2.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.24.1",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"eslint": "^4.19.1",
"file-loader": "^2.0.0",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"url-loader": "^1.1.1"
},
"dependencies": {
"#types/recompose": "^0.27.0",
"antd": "^3.8.2",
"concurrently": "^4.0.1",
"cors": "^2.8.4",
"datatables.net": "^1.10.19",
"es6-promise": "^4.2.5",
"font-awesome": "^4.7.0",
"google-map-react": "^1.1.0",
"google-maps-react": "^2.0.2",
"isomorphic-fetch": "^2.2.1",
"jwt-auth": "^2.0.1",
"jwt-decode": "^2.2.0",
"react-bootstrap": "^0.32.4",
"react-bootstrap-sweetalert": "^4.4.1",
"react-bootstrap-table": "^4.3.1",
"react-bootstrap-table-next": "^1.2.1",
"react-bootstrap-table2-paginator": "^1.0.3",
"react-bootstrap-table2-toolkit": "^1.1.1",
"react-bs-notifier": "^5.0.0",
"react-filter-search": "^1.0.8",
"react-geolocated": "^2.4.0",
"react-geolocation": "^1.0.4",
"react-google-maps": "^9.4.5",
"react-js-pagination": "^3.0.2",
"react-quill": "^1.3.1",
"react-recaptcha": "^2.3.10",
"react-redux": "^5.0.7",
"react-responsive-data-table": "^1.0.4",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-s-alert": "^1.4.1",
"react-search-input": "^0.11.3",
"routes": "^2.1.0",
"sweetalert": "^2.1.0",
"sweetalert-react": "^0.4.11",
"sweetalert2": "^7.28.4"
}
}
Here's my webpack.config.js
const webpack = require('webpack')
const path = require('path')
const fs = require('fs')
const package = require('./package.json')
const LIBRARY_NAME = 'fuse'
const VERSION = package.version
const AUTHOR = package.author
const HOMEPAGE = package.homepage
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin
const env = process.env.WEBPACK_ENV
let copyright = fs.readFileSync('COPYRIGHT.txt', 'UTF8')
let outputFile
let plugins = [
new webpack.BannerPlugin({
banner: copyright
.replace('{VERSION}', `v${VERSION}`)
.replace('{AUTHOR_URL}', `${AUTHOR.url}`)
.replace('{HOMEPAGE}', `${HOMEPAGE}`),
entryOnly: true
})
]
if (env === 'build') {
plugins.push(new UglifyJsPlugin({ minimize: true }))
outputFile = `${LIBRARY_NAME}.min.js`
} else {
outputFile = `${LIBRARY_NAME}.js`
}
const config = {
entry: __dirname + './src/index.js',
devtool: 'source-map',
entry: './src',
output: {
path: __dirname + '/dist',
filename: outputFile,
library: 'Fuse',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
loaders: [{
test: /(\.js)$/,
loader: 'babel-loader',
exclude: /(node_modules)/
}]
},
plugins: plugins
}
module.exports = config
When I browse the page look this
after i npm run build it look like this..
npm run build
is missed in the script in package.json.
If you want you deploy npm run prod.
Or you can run npm run watch to see for code changes in real time, but it's good to use on local developement.
If you are working on laravel mix project, you need to set your apache config.
open file/etc/apache2/sites-available/000-default.conf and then
write your own root directory path
DocumentRoot /var/www/<your directory>/public
Next, change you .htacces file : open up /var/www/mmc1/public/.htaccess
write the following at the top
DirectoryIndex index.php
Now, we need to make your server recognize the .htaccess configuration
Go to /etc/apache2/apache2.conf and change
AllowOverride None into AllowOverride All
<Directory /var/www/<your dir>/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
On your terminal,
sudo a2enmod rewrite //rewrite module enable
sudo service restart apache2 //restart your server
And it would be work well...
Related
First of all, thank you all for your attention. I'm new about react/redux code, and I have an old project that already existed and I only need to duplicate it because they need the same version with some different parameters.
So, I duplicated the old project, created a new gitlab project for it, changed what I needed(practically only text) on the duplicated project, then how it was showing many errors after "npm run build", I did:
Inside the package.json file I changed "node-sass" to use the version 4.11.0 because the old one was generating some "Module not found: Error: Cannot resolve module" kind of errors(as I said, this was a duplication from a old project that even is still running on production has many deprecated dependencies).
I deleted the package-lock.json file.
I deleted also the node_modules folder.
I did "npm install" already on the master branch of the folder to create again the node_modules.
As you can see, I just tried to delete the package-lock.json file then I deleted the node_modules folder, and finally I did "npm install", but when I tried "npm run build", the async_hooks error showed up... I'm stuck in this part.
After these basic steps, the error happened: Cannot resolve module 'async_hooks'. I tried to "npm install async_hooks" but it didn't work, I also tried to put the "async-hooks" on the package.json file but it didn't work, and finally I also tried put a new version from bluebird there but didn't work too.
How to install this "async_hooks"? Because even after doing "npm install async_hooks" it didn't work yet. I run "npm run build" but the same error happened.
See below the full result:
Module not found: Error: Cannot resolve module 'async_hooks' in C:\xampp\htdocs\careers\node_modules\bluebird\js\release
# ./~/bluebird/js/release/util.js 410:18-40
ERROR in ./~/bluebird/js/release/promise.js
Module not found: Error: Cannot resolve module 'async_hooks' in C:\xampp\htdocs\careers\node_modules\bluebird\js\release
# ./~/bluebird/js/release/promise.js 34:4-26
. Here is my package.json file:
"main": "index.js",
"repository": "git#github.com:StephenGrider/ReduxSimpleStarter.git",
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"build": "node ./node_modules/webpack/bin/webpack.js ",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
"test:watch": "npm run test -- --watch"
},
"license": "ISC",
"engines": {
"node": "^v8.9.4"
},
"devDependencies": {
"babel-core": "^6.2.1",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-react-constant-elements": "^6.3.13",
"babel-plugin-transform-react-inline-elements": "^6.3.13",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.1.18",
"babel-preset-es2015-node5": "^1.2.0",
"babel-preset-react": "^6.1.18",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-1": "^6.1.18",
"babel-register": "^6.11.6",
"babel-runtime": "^6.11.6",
"bootstrap-loader": "^1.1.0-beta.1",
"bootstrap-sass": "^3.3.7",
"chai": "~3.5.0",
"chai-jquery": "~2.0.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"jquery": "~2.2.1",
"jsdom": "~8.1.0",
"mocha": "~2.4.5",
"node-sass": "^4.11.0",
"postcss-loader": "^0.9.1",
"react-addons-test-utils": "~0.14.7",
"resolve-url-loader": "^1.6.0",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "~1.12.9",
"webpack-dev-server": "~1.14.0"
},
"dependencies": {
"axios": "~0.13.1",
"bluebird": "^3.4.1",
"css-loader": "^0.23.1",
"griddle-react": "~0.6.0",
"immutable": "^3.8.1",
"jwt-decode": "^2.2.0",
"lodash": "~3.10.1",
"moment": "^2.19.1",
"nested-property": "^0.0.7",
"numeral": "^2.0.6",
"react": "^0.14.3",
"react-datetime": "^2.10.3",
"react-dom": "^0.14.3",
"react-ga": "^2.3.5",
"react-redux": "~4.3.0",
"react-router": "~2.0.1",
"redux": "~3.1.7",
"redux-form": "^6.1.1",
"redux-logger": "^3.0.1",
"redux-thunk": "^2.2.0"
}
}
. and here is my webpack.config.js file:
var path = require('path');
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.join(__dirname,'./js/'),
publicPath: '/js/',
filename: 'bundle.js'
},
module: {
loaders: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-1']
}
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};
Any ideas?
I have a reactjs app - which is running well in dev environment. I mean, when I use
npm start
It's running in localhost:8080 without any issues.
When I try to execute the same with below command, to generate a distribution folder for static hosting, somewhere in AWS S3. That's where the problem.
npm run build
Below is my output folder structure when I execute the above command:
dist
bundle.js
bundle.js.map
public
index.html
I have gone through these posts (regarding warning which I'm getting related to bundle.js file sizes & this link) and did modify as per the suggestion, but I haven't got the desired outcome.
Below is my package.json for reference:
{
"name": "react-starter",
"version": "1.1.5",
"description": "example",
"main": "dist/bundle.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --config ./webpack.dev.js",
"build": "webpack --max_old_space_size=4096 --config ./webpack.prod.js --progress --profile --colors"
},
"homepage": ".",
"keywords": [
"react"
],
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-loader": "^7.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^3.2.0",
"dotenv": "^6.2.0",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^1.6.0",
"file-loader": "^1.1.11",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"sass-loader": "^7.1.0",
"style-loader": "^0.21.0",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.3.0",
"uglifyjs-webpack-plugin": "^2.1.3",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4",
"webpack-dev-server": "^3.7.1",
"webpack-merge": "^4.1.4"
},
"dependencies": {
"bootstrap": "^4.3.1",
"i18next": "^16.0.0",
"i18next-browser-languagedetector": "^3.0.1",
"konva": "^2.5.1",
"normalizr": "^3.4.0",
"prop-types": "^15.7.2",
"react-hot-loader": "^4.11.1",
"react-i18next": "^10.11.1",
"react-icons": "^3.7.0",
"react-konva": "^16.8.6",
"react-player": "^1.11.1",
"react-scroll": "^1.7.12",
"reactstrap": "^6.5.0"
},
"peerDependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
webpack.prod.js is below:
const path = require('path');
const merge = require('webpack-merge');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
entry: 'apps/index.js',
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: '/dist/',
filename: 'bundle.js',
libraryTarget: 'commonjs2',
},
plugins: [
new CleanWebpackPlugin(['dist/*.*']),
],
externals: {
react: 'react',
'react-dom': 'react-dom',
},
});
I also noticed some deprecations in the library which I'm trying to integrate with. I've installed the missing peer dependencies. I've reported the issues with the library here.
I believe to upload it to S3, we should have all necessary files in the dist or public folder along with index.html which would be added as a prefix in S3 from where the app gets the entry point.
Any help on this would be highly appreciated. Also, I would be ready to provide any additional information.
Looking at your package.json file it seems you haven't used create-react-app.
I suggest to simply create a new React.js app using it and copy the content of your app in the newly created. It's easy and it works.
Hope this helps.
Just getting things working is not enough. You should go through a simple guide to setup things step-by-step like these
creating-a-production-ready-webpack-4-config-from-scratch
react-boilerplate using WebPack 4
And try some simple boilerplate projects before messing with a complex one like these
react-boilerplate
react-webpack-boilerplate
And yes starting with create-react-app is also good as suggested by #Daniele Ricci and You can use react-scripts eject to understand what's going on under the hood.
I am using laravel for backend and ReactJS for the frontend. I tried to use the asyncComponent method for loading components when needed, to decrease load time. The issue is that I am getting an error in dynamic import below:
const asyncCheckout = asyncComponent(() => {
return import('./containers/Checkout/Checkout');
});
I am getting error Unexpected token error on import keyword. I tried installing babel-plugin-syntax-dynamic-import but it still gives Unexpected token error. I am new to React and I would appreciate any help that can point me in the right direction. My .babelrc file has latest and react and env as presets. Thanks you.
My .babelrc file that is in project root:
{
"presets": [
"env"
],
"plugins": ["transform-class-properties"]
}
Web pack config, from laravel mix:
/**
* As our first step, we'll pull in the user's webpack.mix.js
* file. Based on what the user requests in that file,
* a generic config object will be constructed for us.
*/
require('../src/index');
require(Mix.paths.mix());
/**
* Just in case the user needs to hook into this point
* in the build process, we'll make an announcement.
*/
Mix.dispatch('init', Mix);
/**
* Now that we know which build tasks are required by the
* user, we can dynamically create a configuration object
* for Webpack. And that's all there is to it. Simple!
*/
let WebpackConfig = require('../src/builder/WebpackConfig');
module.exports = new WebpackConfig().build();
And my package.json file:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.17",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-latest": "^6.24.1",
"babel-preset-react": "^6.23.0",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"dependencies": {
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"react-bootstrap": "^0.31.5",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-social-login": "^3.4.2",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
"watch": "^1.0.2"
}
}
the best way i found to do a dynamic import is :)
use require() instead of import();
const HomeLazy = React.lazy(() => {
return new Promise((resolve) => {
setTimeout(() => resolve(require("./pages/home")), 300);
});
});
I need some help to bundle my output for production but I have no idea how. Here's my webpack.config.js
module.exports = {
devtool: 'eval',
context: __dirname,
entry: "./js-source/index.jsx",
output: {
path: __dirname + "/scripts",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
}
],
resolve: {
extensions: ['', '.js', '.jsx', '.json']
}
}
};
Here's my package.json
{
"name": "citygross-store-web",
"version": "2.0.0",
"dependencies": {
"axios": "^0.14.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-redux": "^4.1.2",
"react-responsive": "^1.3.0",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-transition-group": "^1.2.0",
"redux": "^3.1.2",
"redux-logger": "^2.6.1",
"redux-promise-middleware": "^4.0.0",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.24.1",
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-preset-stage-2": "^6.13.0",
"webpack": "^1.14.0",
"webpack-hot-middleware": "^2.12.2"
},
"scripts": {
"build": "webpack --colors",
"dev": "webpack --watch --colors"
},
"-vs-binding": {
"ProjectOpened": [
"dev"
]
}
}
How do you usually bundle for production? By adding a command like "npm run build" and having the other settings in that setting?
I would appreciate if someone could help me out how to set this up. Right now I can do "npm run dev" and "npm run build", however there's no difference between using the two more than "run dev" creates a -watcher and build builds the bundle one time.
Set the environment variable NODE_ENV to production when running your build script. This will cause the production build of React to be included in the output.
Easiest way is to add another script to your package.json:
"scripts": {
"build": "webpack --colors",
"buildprod": "NODE_ENV=production webpack --colors",
"dev": "webpack --watch --colors"
},
Now when you do npm run buildprod, you'll get a production build of your code.
Note: if you are on Windows, the above won't work right. For proper cross-OS you should use cross-env:
Install cross-env:
npm install cross-env --save-dev
or
yarn add cross-env --dev
Then make your scripts section look like:
"scripts": {
"build": "webpack --colors",
"buildprod": "cross-env NODE_ENV=production webpack --colors",
"dev": "webpack --watch --colors"
},
I´ve built my project upon the generator-react-webpack. Now I am trying to deploy my react app to Heroku. In the process of Building dependencies I get an error:
npm run copy & webpack --env=dist
remote:
remote: Hash: 82c8f499a3f6822a3522
remote: Version: webpack 1.13.3
remote: Time: 73ms
remote:
remote: ERROR in Entry module not found: Error: Cannot resolve module 'babel' in /tmp/build_a9e8f64bdab19b2486d922d4ba0f3d83
There seems to be something weird with the loader. I´ve tried to include 'babel' in dependencies, and also tried to replace it with 'babel-core' and it did not work.
I´m super frustrated with this problem and would appreciate it alot if someone could help me. Thanks!
package.json
{
"name": "templateApp",
"private": true,
"version": "0.0.1",
"description": "Template application for future builds",
"main": "",
"engines": {
"node": "6.2.2"
},
"scripts": {
"clean": "rimraf dist/*",
"copy": "copyfiles -f ./src/index.html ./src/favicon.ico ./dist",
"dist": "npm run copy & webpack --env=dist",
"lint": "eslint ./src",
"posttest": "npm run lint",
"release:major": "npm version major && npm publish && git push --follow-tags",
"release:minor": "npm version minor && npm publish && git push --follow-tags",
"release:patch": "npm version patch && npm publish && git push --follow-tags",
"serve": "node server.js --env=dev",
"serve:dist": "node server.js --env=dist",
"dev": "node server.js --env=dev",
"start": "node server.js --env=dev",
"test": "karma start",
"test:watch": "karma start --autoWatch=true --singleRun=false",
"postinstall": "npm run dist && npm run start"
},
"repository": "",
"keywords": [],
"author": "Alfred Ödling",
"devDependencies": {
"babel-core": "^6.0.0",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.0.15",
"babel-preset-react": "^6.0.15",
"babel-preset-stage-0": "^6.5.0",
"bower-webpack-plugin": "^0.1.9",
"chai": "^3.2.0",
"copyfiles": "^0.2.1",
"css-loader": "^0.23.0",
"eslint": "^2.2.0",
"eslint-loader": "^1.0.0",
"eslint-plugin-react": "^5.0.0",
"file-loader": "^0.8.4",
"glob": "^7.0.0",
"isparta-instrumenter-loader": "^1.0.0",
"karma": "^0.13.9",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.0.0",
"karma-mocha": "^1.0.0",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0",
"lost": "^7.0.3",
"minimist": "^1.2.0",
"mocha": "^2.2.5",
"node-sass": "^3.4.2",
"null-loader": "^0.1.1",
"open": "0.0.5",
"phantomjs-prebuilt": "^2.0.0",
"postcss": "^5.0.11",
"postcss-loader": "^0.8.0",
"react-addons-test-utils": "^15.0.0",
"react-hot-loader": "^1.2.9",
"rimraf": "^2.4.3",
"rucksack-css": "^0.8.6",
"sass-loader": "^3.1.2",
"style-loader": "^0.13.0",
"url-loader": "^0.5.6",
"webpack": "^1.12.0",
"webpack-dev-server": "^1.12.0"
},
"dependencies": {
"autoprefixer": "^6.3.7",
"axios": "^0.13.1",
"classnames": "^2.2.5",
"clipboard": "^1.5.12",
"core-js": "^2.0.0",
"firebase": "^3.4.1",
"fixed-data-table": "^0.6.3",
"flat": "^2.0.1",
"history": "^3.0.0",
"lodash": "^4.15.0",
"lost": "^7.0.3",
"normalize.css": "^4.0.0",
"postcss": "^5.1.1",
"postcss-cli": "^2.5.2",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.8.2",
"react": "^15.0.0",
"react-addons-css-transition-group": "^15.3.0",
"react-cookie": "^0.4.8",
"react-datagrid": "^2.1.1",
"react-dom": "^15.3.1",
"react-redux": "^4.4.5",
"react-router": "^2.6.1",
"react-tooltip": "^3.2.1",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
"rucksack-css": "^0.8.6",
"seamless-immutable": "^6.1.1"
}
}
dist.js
'use strict';
let path = require('path');
let webpack = require('webpack');
let baseConfig = require('./base');
let defaultSettings = require('./defaults');
// Add needed plugins here
let BowerWebpackPlugin = require('bower-webpack-plugin');
let config = Object.assign({}, baseConfig, {
entry: path.join(__dirname, '../src/index'),
cache: false,
devtool: 'sourcemap',
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new BowerWebpackPlugin({
searchResolveModulesDirectories: false
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.NoErrorsPlugin()
],
module: defaultSettings.getDefaultModules()
});
// Add needed loaders to the defaults here
config.module.loaders.push({
test: /\.(js|jsx)$/,
loader: 'babel',
include: [].concat(
config.additionalPaths,
[ path.join(__dirname, '/../src') ]
)
});
module.exports = config;
From https://github.com/mxstbr/react-boilerplate/issues/914
"Make sure you set NPM_CONFIG_PRODUCTION=false on heroku. Without this devDependencies won't be installed. Which are needed for this boilerplate to build.
If you have heroku cli installed you can
heroku config:set NPM_CONFIG_PRODUCTION=false --app your-app-name
else go to the settings tab on your app and add in Config Variables"
This fixed it!
Can you change your entry from your dist.js file to this:
entry: [
'babel-polyfill',
path.join(__dirname, '../src/index')
],