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

files in output will been default exclude? #8

Closed
qinyang912 opened this issue Aug 17, 2018 · 7 comments
Closed

files in output will been default exclude? #8

qinyang912 opened this issue Aug 17, 2018 · 7 comments

Comments

@qinyang912
Copy link

qinyang912 commented Aug 17, 2018

I want to delete files in output path, but I see the source code has auto ignore the files in output path

// exclude files
const excludePatterns = [
  outputPath,
  ...this.options.exclude.map(name => path.join(outputPath, name)),
  ...assetNames.map(name => path.join(outputPath, name))
]
@qinyang912 qinyang912 changed the title files in output will been default ignore? files in output will been default exclude? Aug 17, 2018
@AMontagu
Copy link

Look like my problem.
I need to delete a file generated by webpack but it seem ignored by this plugin:

===== Del Webpack Plugin ===
Added files:
tmp/something.js
main.js

Deleted files:
tmp
============================

@jackypan1989
Copy link
Owner

You mean you wanna delete some new generated files by webpack?

@qinyang912
Copy link
Author

@jackypan1989 yes
I'm using webpack to develop a library, the webpack config look like:

{
  entry: {
    'main': './src/index.js',
    'core': ['a.scss', 'b.scss']
  },
  output: {
    filename: '[name].js',
    library: 'Test',
    path: './dist'
  },
  plugins: [
    new ExtractTextPlugin({
      filename: '[name].css',
    })
  ]
}

when build, will generate three files in output path:

main.js
core.js
core.css

I wanna customize the name of css file, so I must import all scss files in an entry, but this will generate a useless javascript file, so I wanna delete core.js

@AMontagu
Copy link

almost the same for me. I use webpack to bundle multiple web application but some are just html/css/js so no need of main.js file created by webpack.

@jackypan1989
Copy link
Owner

I will checkout this issue soon.

@qinyang912
Copy link
Author

@jackypan1989 thanks.

@jackypan1989
Copy link
Owner

jackypan1989 commented Aug 29, 2018

https://github.com/jackypan1989/del-webpack-plugin/releases/tag/v1.1.0

You can set keepGeneratedAssets to false now,
and all generated filed will not be excluded by default.

Notice: You may need to write some exclude patterns to keep files.

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

3 participants