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

[Bug] image and vue loaders fail in v2.0.0 #65

Open
1 task
AnthonyElcocks opened this issue May 6, 2020 · 3 comments
Open
1 task

[Bug] image and vue loaders fail in v2.0.0 #65

AnthonyElcocks opened this issue May 6, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@AnthonyElcocks
Copy link

  • I'd be willing to submit the fix

Describe the bug

I have a project using mochapack with file-loader and vue-loader.
Webpack.config has module.rules for file-loader and vue-loader
{
test: /.vue$/,
use: "vue-loader"
},
{
test: /.(png|svg|jpg|gif)$/,
use: {
loader: "file-loader",
options: {
name: "[path][name].[ext]?[hash]",
context: "",
esModule: false
}
}
}
There are others but these are the relevant ones.

I have a script in package.json as follows:
"test": "cross-env NODE_ENV=test mochapack test/**/*-test.js"

When mochapack v1.1.15 is installed the tests run without error.
If v2.0.0 is installed I get errors for img files imported as ... import "../images/exclamation.png";
and errors for vue files

The messages are as follows...

For images:

Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
and for Vue files:

Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

| <b-modal
| id="info-dialog"

To Reproduce
I have not had time to whittle the code to a simple example yet, especially since 2.0.0 is only 7 ours old according to github :)

I am registering the issue so you are aware. I will reply when I have a small project to use.

The minimal information needed to reproduce your issue (ideally a very minimal project setup published on GitHub).
Note that bugs without minimal reproductions might be closed.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment if relevant (please complete the following information):

  • OS: Windows 10
  • Node version 12.16.2
  • Mochapack version 2.0.0
  • Webpack version 4.41.5
@AnthonyElcocks AnthonyElcocks added the bug Something isn't working label May 6, 2020
@AnthonyElcocks AnthonyElcocks changed the title [Bug] [Bug] image and vue loaders fail in v2.0.0 May 6, 2020
@larixer
Copy link
Member

larixer commented May 6, 2020

@AnthonyElcocks Thanks for the report, we will keep it in mind, though to make it really actionable from our side, we really need a reproduction, some repo, small or not so small which we can clone and see the problem ourselves and then troubleshoot it from there.

@indeyets
Copy link

indeyets commented Jun 4, 2020

@AnthonyElcocks explicitly specifying path to webpack.config file helped on one of my projects where I had similar issue

@jcjp
Copy link

jcjp commented Jun 26, 2020

I think you need to add this on your rules in webpack.config.js or mochapack.config.js:

{
 test: /\.(jpg|JPG|jpeg|png|gif|mp3|svg|ttf|woff2|woff|eot)$/gi,
 use: 'file-loader'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants