Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
legomushroom committed Jan 11, 2017
2 parents 929df28 + 0df0abb commit 39eb512
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 94 deletions.
88 changes: 0 additions & 88 deletions gulpfile.js

This file was deleted.

4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ bower install mojs-curve-editor
Import `MojsCurveEditor` constructor to your code (depends on your environment) :

```javascript
const MojsCurveEditor = require('mojs-player').default;
const MojsCurveEditor = require('mojs-curve-editor').default;
// or
import MojsCurveEditor from 'mojs-player';
import MojsCurveEditor from 'mojs-curve-editor';
```

If you installed it with script link - you should have `MojsCurveEditor` global.
Expand Down
78 changes: 78 additions & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import webpack from 'webpack';
import path from 'path';
import autoprefixer from 'autoprefixer';
import UnminifiedWebpackPlugin from 'unminified-webpack-plugin';

const LAUNCH_COMMAND = process.env.npm_lifecycle_event;
const isProduction = LAUNCH_COMMAND === 'production';
process.env.BABEL_ENV = LAUNCH_COMMAND

const base = {
context: __dirname + '/',
entry: [
__dirname + '/app/js/app.babel.jsx'
],
module: {
preLoaders: [
{
exclude: /src\//,
loader: 'source-map'
}
],
loaders: [
{ test: /\.(json)$/, exclude: /node_modules/, loaders: ['json-loader'] },
{ test: /\.(jsx|.js|babel.jsx|babel.js)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{ test: /\.(postcss.css)$/, loader: 'style-loader!css-loader!postcss-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
{
test: /\.(eot|woff|ttf|svg|png|jpg|wav|mp3)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]',
}
]
},
postcss: function () {
return {
defaults: [ require('precss'), require('postcss-cssnext'), require('postcss-modules') ],
cleaner: [autoprefixer({ browsers: ['last 2 versions'] })]
};
},
output: {
path: __dirname + '/app/build/',
filename: 'mojs-curve-editor.min.js',
publicPath: 'build/',
library: 'mojs-curve-editor',
libraryTarget: 'umd',
umdNamedDefine: true,
},
plugins: [new UnminifiedWebpackPlugin()],
resolve: {
root: [ path.resolve('./') ],
moduleDirectories: ['node_modules'],
target: 'node',
extensions: [
'', '.js', '.babel.js', '.babel.jsx',
'.postcss.css', '.css', '.json'
]
}
};

const productionPlugin = new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})

const developmentConfig = {
// devtool: 'inline-source-map'
// watch: true,
}

const productionConfig = {
// devtool: 'source-map',
plugins: [productionPlugin, new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}})]
}

export default Object.assign({}, base, isProduction === true ? productionConfig : developmentConfig)
6 changes: 2 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,15 @@ module.exports = {
// new webpack.NoErrorsPlugin(),
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
compress: { warnings: false }
}),
new UnminifiedWebpackPlugin()
// new webpack.HotModuleReplacementPlugin()
],
// devtool: process.env.NODE_ENV==='production' ? 'source-map' : 'inline-source-map',
resolve: {
root: [ path.resolve('./') ],
moduleDirectories: ['node_modules', 'vendor'],
moduleDirectories: ['node_modules'],
target: 'node',
extensions: [
'', '.js', '.babel.js', '.babel.jsx',
Expand Down

0 comments on commit 39eb512

Please sign in to comment.