I have a project which is building successfully on Jenkins but when I try to build using AWS Codebuild it gives a plugin error. The project is basically a NodeJS and ReactJS project. We do not want to move to Jenkins as we are serverless and installing jenkins requires one EC2 instance. We do not want to maintain any server. I have tried below environments for AWS codebuild:
aws/codebuild/ubuntu-base:14.04
aws/codebuild/nodejs:6.3.1
aws/codebuild/nodejs:7.0.0
aws/codebuild/nodejs:4.4.7
The first four commands of my buildspec.yml is executed only when I use aws/codebuild/ubuntu-base:14.04
codebuild environment. Otherwise only last three commands are part of my buildspec.yml
Below is my buildspec.yml
version: 0.1
phases:
build:
commands:
- sudo apt-get update
- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
- sudo apt-get install -y nodejs
- sudo apt-get install -y build-essential
- npm install
- npm run dev
- aws s3 cp --recursive dist/ s3://$AWS_BUCKET_NAME/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Below is my error logs in AWS codebuild during npm run
ERROR in
Child html-webpack-plugin for "index.html":
+ 3 hidden modules
Also, I get following warning during npm install in Codebuild but I do not get the this warning in Jenkins
npm WARN deprecated babel-plugin-react-hot@1.0.4: This plugin is no longer maintained. Please use babel-plugin-react-transform with react-transform-hot-reload instead.
Below is my webpack.config.js
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');
module.exports = {
entry: [
'./src/app/index.js'
],
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.js$/,
exclude: /(node_modules|test)/,
loaders: ["babel-loader"]
},
{
test: /\.(css|scss)$/,
loaders: ['style', 'css', 'sass-loader']
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader',
options: {
limit: 100000,
name: 'assets/[hash].[ext]'
}
},
{
test: /\.styl$/,
loader: 'style-loader!css-loader!postcss-loader!stylus-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: __dirname + '/src/app/index.html',
filename: 'index.html',
inject: 'body'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new webpack.DefinePlugin({
"process.env": {
'NODE_ENV': JSON.stringify('dev')
}
}),
new FlowStatusWebpackPlugin({
failOnError: true
})
],
devtool: 'source-map',
node: {
tls: "empty",
fs: "empty"
},
resolve: {
root: path.resolve(__dirname),
alias: {
'~': 'src',
},
extensions: ['', '.js', '.jsx']
},
};
via deosha
No comments:
Post a Comment