mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
js: Let ESBuild handle all imports from node_modules
This commit fixes some issues where modules in /assets share the same name as in node_modules. This was not intended, and with this commit the node_modules-components should be isolated. If you want to redefine something inside node_modules, use the `defines` option. Fixes #7948
This commit is contained in:
committed by
GitHub
parent
5e03f644a4
commit
78f227b664
@@ -394,9 +394,14 @@ func TestMakePathRelative(t *testing.T) {
|
||||
sfs := bfs.Static[""]
|
||||
c.Assert(sfs, qt.Not(qt.IsNil))
|
||||
|
||||
c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "dist", "d1", "foo.txt")), qt.Equals, filepath.FromSlash("mydist/d1/foo.txt"))
|
||||
c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "static", "d2", "foo.txt")), qt.Equals, filepath.FromSlash("d2/foo.txt"))
|
||||
c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "dust", "d3", "foo.txt")), qt.Equals, filepath.FromSlash("foo/bar/d3/foo.txt"))
|
||||
makeRel := func(s string) string {
|
||||
r, _ := sfs.MakePathRelative(s)
|
||||
return r
|
||||
}
|
||||
|
||||
c.Assert(makeRel(filepath.Join(workDir, "dist", "d1", "foo.txt")), qt.Equals, filepath.FromSlash("mydist/d1/foo.txt"))
|
||||
c.Assert(makeRel(filepath.Join(workDir, "static", "d2", "foo.txt")), qt.Equals, filepath.FromSlash("d2/foo.txt"))
|
||||
c.Assert(makeRel(filepath.Join(workDir, "dust", "d3", "foo.txt")), qt.Equals, filepath.FromSlash("foo/bar/d3/foo.txt"))
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user