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

doesn't work in webpack-stream #174

Open
cca313 opened this issue Sep 18, 2017 · 2 comments
Open

doesn't work in webpack-stream #174

cca313 opened this issue Sep 18, 2017 · 2 comments

Comments

@cca313
Copy link

cca313 commented Sep 18, 2017

webpack

const webpackConfig = {
  resolve: {
    root: path.join(__dirname, 'node_modules'),
    alias: {
      components: '../../components', // 组件别名,js里引用路径可直接 'components/xxx/yyy'
      reducers: '../../reducers',
      actions: '../../actions',
      stores: '../../stores',
      helpers: '../../helpers'
    },
    extensions: ['', '.js', '.jsx', '.scss', '.css']
  },
  output: {
    filename: 'js/[name].js',
    chunkFilename: 'js/[id].js?[hash]'
  },
  module: {
    loaders: [
      {
        test: /\.js|jsx$/,
        exclude: /node_modules/,
        loader: 'babel-loader?cacheDirectory'
      },
      {
        test: /\.css$/,
        loader: ('style-loader', 'css-loader')
      },
      {
        test: /\.(png|jpe?g|gif)(\?.*)?$/,
        loader: 'url',
        query: {
          limit: 5000, // 换成你想要得大小
          name: 'images/[name].[ext]?[hash:10]'
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
        loader: 'url',
        query: {
          limit: 5000, // 换成你想要得大小
          name: 'fonts/[name].[hash:7].[ext]'
        }
      }
    ]
  },
  externals: {
    'react': 'React',
    'react-dom': 'ReactDOM'
  }
}

.babelrc

  "presets": [
    "es2015", "stage-2", "react", "env"
  ],
  "plugins": [
    "transform-class-properties",
    "transform-object-rest-spread",
    ["import",{ "libraryName": "antd", "style": "css" }]
  ],
   "env": {
      "build": {
        "optional": ["optimisation", "minification"]
      }
    }
@cca313
Copy link
Author

cca313 commented Sep 18, 2017

@sorrycc

@sorrycc
Copy link
Member

sorrycc commented Sep 20, 2017

What's webpack-stream?

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