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

About external script file #16

Open
cncolder opened this issue Jan 5, 2016 · 0 comments
Open

About external script file #16

cncolder opened this issue Jan 5, 2016 · 0 comments

Comments

@cncolder
Copy link

cncolder commented Jan 5, 2016

Since I have sent a pull request #15 about compile external script file. But I still have a question. I need tell webpack our tag file dependency that external js file. So that webpack should recompile in watch mode after I save my js file.

I can't find a good way to do that. I have some ugly code in my own usage. Use regex match source string then add dependency it.

    var match = /<script.*?src="(.*?)"/gmi.exec(source)
    if (match) {
      let script = path.resolve(path.dirname(this.resourcePath), match[1])
      this.dependency(script)
    }

If someone thinking this is acceptable or provide a better regex. I can make this loader work better.

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

1 participant