Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chart do not render after build #26

Closed
crazy0x opened this issue Dec 22, 2016 · 4 comments
Closed

chart do not render after build #26

crazy0x opened this issue Dec 22, 2016 · 4 comments

Comments

@crazy0x
Copy link

crazy0x commented Dec 22, 2016

Expected Behavior

chart works well on both dev and build environment

Actual Behavior

executing npm run dev

everything works well.

executing npm run build and upload to server

it shows error: Uncaught ReferenceError: o is not defined

Environment

  • OS: macOS Sierra 10.12.2
  • NPM Version: 4.0.5

it seems similar to #19 but I already used babel

how can I make it right?

package.json

{
  "name": "name",
  "description": "description",
  "author": "author",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "babel-polyfill": "*",
    "element-ui": "^1.0.0-rc.4",
    "v-vuerify-next": "^0.2.0",
    "vue": "^2.0.1",
    "vue-chartjs": "^2.3.1",
    "vue-resource": "^1.0.3",
    "vue-router": "^2.0.0",
    "vuerify": "^0.3.0",
    "vuex": "^2.0.0"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-plugin-transform-runtime": "^6.15.0",
    "babel-preset-es2015": "^6.16.0",
    "babel-preset-stage-0": "^6.16.0",
    "babel-runtime": "^6.11.6",
    "cross-env": "^1.0.6",
    "css-loader": "^0.23.1",
    "file-loader": "^0.8.5",
    "style-loader": "^0.13.1",
    "vue-loader": "^9.5.1",
    "webpack": "2.1.0-beta.22",
    "webpack-dev-server": "^2.1.0-beta.0"
  }
}

webpack.config.js

var path = require('path')
var webpack = require('webpack')

module.exports = {
  entry: './src/main.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    publicPath: 'dist/',
    filename: 'build.js'
  },
  resolveLoader: {
    root: path.join(__dirname, 'node_modules'),
  },
  module: {
    loaders: [
      {
        test: /\.vue$/,
        loader: 'vue'
      },
      {
        test: /\.js$/,
        loader: 'babel',
        exclude: /node_modules/
      },
      {
        test: /\.css$/,
        loader: 'style!css'
      },
      {
        test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
        loader: 'file'
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/,
        loader: 'file',
        query: {
          name: '[name].[ext]?[hash]'
        }
      }
    ]
  },
  babel: {
    babelrc: false,
      presets: [
          ['es2015'],
      ],
  },
  devServer: {
    historyApiFallback: true,
    noInfo: true
  },
  devtool: '#eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
  module.exports.devtool = '#source-map'
  // http://vue-loader.vuejs.org/en/workflow/production.html
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ])
}

@apertureless
Copy link
Owner

hey @crazy0x

can you maybe provide a minimal repo I can checkout with a reproduction of the issue ?

@apertureless
Copy link
Owner

@crazy0x Can you try to update to vue-chartjs 2.3.2 ?
I changed the release build, to be not minified.

@crazy0x
Copy link
Author

crazy0x commented Dec 26, 2016

sry i reply so late

i update to 2.3.2 and build again, problem solved.

thx for your support!

@apertureless
Copy link
Owner

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants