Yarn: Yarn not publishing output folder

Created on 14 Apr 2017  Â·  10Comments  Â·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug report

What is the current behavior?
Yarn does not publish the output files from webpack (while npm publish still does). I have tried publishing the same node module with npm and yarn, in case of npm the output is successfully exported.

WIth yarn (dist folder missing):

LICENSE README.md main.js package.json
WIth npm
LICENSE README.md dist main.js package.json yarn-error.log yarn.lock

Note that the prepublish command is rm -rf dist && webpack --progress --colors -d and gets executed successfully both by yarn or npm

yarn prepublish v0.23.2
$ rm -rf dist && webpack --progress --colors -d
Hash: d971e15f743892671dce
Version: webpack 1.15.0
Time: 6443ms
                 Asset    Size  Chunks             Chunk Names
    react-coverflow.js  164 kB       0  [emitted]  react-coverflow
react-coverflow.js.map  854 kB       0  [emitted]  react-coverflow
   [0] multi react-coverflow 28 bytes {0} [built]
    + 185 hidden modules
✨  Done in 7.91s.

Content of webpack.config.js (link to repo below)

const path = require('path');
const glob = require('glob');
const webpack = require('webpack');
const precss = require('precss');
const autoprefixer = require('autoprefixer');

const plugins = [
  new webpack.optimize.DedupePlugin(),
  new webpack.optimize.UglifyJsPlugin({
    compress: {
      warnings: false
    }
  })
];

module.exports = {
  entry: {
    'react-coverflow': glob.sync(path.join(__dirname, './src/*.js'))
  },
  output: {
    path: path.resolve(__dirname, "./dist"),
    filename: '[name].js',
    libraryTarget: 'umd',
    library: 'react-coverflow',
  },
  externals: [
    {
      'react': {
        root: 'React',
        commonjs2: 'react',
        commonjs: 'react',
        amd: 'react'
      }
    },
    {
      'react-dom': {
        root: 'ReactDOM',
        commonjs2: 'react-dom',
        commonjs: 'react-dom',
        amd: 'react-dom'
      }
    }
  ],
  devtool: 'eval-source-map',
  resolve: {
    extensions: ['', '.js', '.jsx', '.json', '.scss', '.css']
  },
  eslint: {
    configFile: './.eslintrc'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel'
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'eslint'
      },
      {
        test: /\.(css|scss)$/,
        loader: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]!sass!postcss'
      }
    ]
  },
  plugins: plugins,
  postcss: function() {
    return [precss, autoprefixer];
  }
};

I tried to publish this package https://github.com/Startouf/react-coverflow

Please mention your node.js, yarn and operating system version.
Yarn v0.23.2
Node v7.7.3
macOS Sierra 10.12.4

good first issue help wanted triaged

Most helpful comment

I seem to be getting this issue on 1.15.2.

All 10 comments

Confirm, npm pack includes dist folder and yarn pack does not

is there a workaround besides switching back to npm?

Help us investigate why the folder is not included.
pack.js files is quite small

@BYK. a candidate for HI PRI?

Will investigate.

I think this guys has the bug: https://github.com/yarnpkg/yarn/blob/master/src/util/filter.js#L149

.dist folder is listed in .gitignore so my suspicion is that we use that instead or on top of .npmignore.

This bug seems to have been resolved with the 0.27.0 release (it can be reproduced until then, but not after that) - I'll close this issue, but feel free to reopen it or to ping me if you think this is a mistake.

I seem to be getting this issue on 1.15.2.

Hi sorry for writing into this issue when it's closed, but i can see this issue on v1.22.0. Is there some parameter/switch/... to ignore .gitignore? I'm working with generated code so there's no easy way to modify .gitignore. Thanks

I'm also seeing the problem in 1.22.0. My workaround was to add a .npmignore file so yarn stops reading .gitignore.

Was this page helpful?
0 / 5 - 0 ratings