ecmascript 6 - ES6 with Webpack doesn't work even I don't get any error -


i follow tutorial , installed webpack use es6 in every browser. when put in app.js console.log('hello world!') didn't on console, first used command 'npm run build'. in comand prompt didn't errors, i'm confused. have no idea happening.

package.json

{  "name": "es6modules",  "version": "1.0.0",  "description": "",  "main": "app.js",  "scripts": {    "build": "webpack --progress --watch"   },  "author": "",  "license": "isc",  "dependencies": {   "flickity": "^2.0.5",   "insane": "^2.6.2",   "jquery": "^3.2.1",   "jsonp": "^0.2.1",   "lodash": "^4.17.4",   "slug": "^0.9.1"  },   "devdependencies": {   "awesome-typescript-loader": "^3.1.2",   "babel-core": "^6.24.0",   "babel-loader": "^6.4.1",   "babel-preset-es2015": "^6.24.0",   "babel-preset-react": "^6.23.0",   "typescript": "^2.2.2",   "webpack": "^2.3.3"  } } 

webpack.config.js

const webpack = require('webpack'); const nodeenv = process.env.node_env || 'production';  // entry - u want start app // loaders - how should handle spec file module.exports = {   devtool: 'source-map',   entry: {      filename: './app.js' }, output: {     filename: '_build/bundle.js' }, module: {     loaders: [         {             test: /\.js$/,             exclude: /node_modules/,             loader: 'babel-loader',             query: {                 presets: [["es2015", { "modules": false }]]             }         }     ] }, plugins: [     // compress js - uglify js     new webpack.optimize.uglifyjsplugin({         compress: { warnings: false },         output: { comments: false },         sourcemap: true      }),     // set actual environment - env plugin     new webpack.defineplugin({         'process.env': { node_env: json.stringify(nodeenv)}     })   ] } 

app.js

import { uniq } 'lodash'; import insane 'insane'; import jsonp 'jsonp';  console.log('hello world!'); const ages = [1, 1, 4, 52, 12, 4]; console.log(uniq(ages)); 

index.html

<html> <head>   <title>js modules</title> </head> <body>   <h3>hello world</h3>   <script scr="_build/bundle.js"></script> </body> 


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -